Skip to content

Commit bb94e2a

Browse files
committed
Port to Vitepress
1 parent 122af22 commit bb94e2a

31 files changed

Lines changed: 675 additions & 953 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.uuid
22
.vscode
3+
package-lock.json
34
*.stats.html
45
/bin/
56
/dist/
@@ -9,3 +10,6 @@
910
/test/test-results.xml
1011
/test/screenshots/test-results.xml
1112
/.nyc_output/
13+
/.vitepress
14+
/docs/.vitepress/cache/
15+
/docs/public/latexjs/

docs/.vitepress/config.mts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { defineConfig } from 'vitepress'
2+
import { fileURLToPath } from 'url'
3+
import path from 'path'
4+
import string from 'vite-plugin-string'
5+
6+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
7+
8+
// https://vitepress.dev/reference/site-config
9+
export default defineConfig({
10+
title: 'LaTeX.js',
11+
description: 'A LaTeX parser written in JavaScript.',
12+
13+
outDir: '../website',
14+
15+
head: [
16+
['link', {
17+
rel: 'icon',
18+
href: 'data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAABJScL/SUnC/0lJwv8AAAAAAAAAAElJwv9JScL/SUnC/wAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAAAAAABJScL/SUnC/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAElJwv9JScL/AAAAAgAAAAUAAAADAAAAAAAAAAAAAAAASUnC/0lJwv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AA=='
19+
}],
20+
['link', { rel: 'stylesheet', href: '/css/error.css' }],
21+
['link', { rel: 'stylesheet', href: '/css/logos.css' }]
22+
],
23+
24+
themeConfig: {
25+
// https://vitepress.dev/reference/default-theme-config
26+
logo: '/img/latexjs.png',
27+
28+
nav: [
29+
{ text: 'Home', link: '/' },
30+
{ text: 'Guide', link: '/usage' },
31+
{ text: 'Playground', link: '/playground' },
32+
{ text: 'ChangeLog', link: 'https://github.com/michael-brade/LaTeX.js/releases' },
33+
{ text: 'GitHub', link: 'https://github.com/michael-brade/LaTeX.js' },
34+
],
35+
36+
sidebar: [
37+
{ text: 'Home', link: '/' },
38+
{ text: 'Usage', link: '/usage' },
39+
{ text: 'API', link: '/api' },
40+
{ text: 'Extending', link: '/extending' },
41+
{ text: 'Limitations', link: '/limitations' }
42+
],
43+
},
44+
45+
// Enable markdown line breaks
46+
markdown: {
47+
breaks: true
48+
},
49+
50+
// Vite-specific configuration
51+
vite: {
52+
plugins: [
53+
// Plugin to import .tex files as strings
54+
string({
55+
include: '**/*.tex',
56+
})
57+
],
58+
resolve: {
59+
alias: {
60+
// Alias to find theme components
61+
'@theme/components': path.resolve(__dirname, './theme/components')
62+
}
63+
}
64+
}
65+
})

docs/.vitepress/theme/Layout.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<DefaultTheme.Layout>
3+
<template #navbar-brand>
4+
<a href="/" class="navbar-brand-link">
5+
<img
6+
vPreload
7+
class="logo"
8+
src="/img/latexjs.png"
9+
alt="LaTeX.js Logo"
10+
/>
11+
<LaTeX />.js
12+
</a>
13+
</template>
14+
</DefaultTheme.Layout>
15+
</template>
16+
17+
<script setup>
18+
import DefaultTheme from 'vitepress/theme'
19+
import LaTeX from './components/LaTeX.vue'
20+
</script>
21+
22+
<style scoped>
23+
/* Style to match old home-link */
24+
.navbar-brand-link {
25+
display: flex;
26+
align-items: center;
27+
font-family: 'Liberation Serif', serif;
28+
font-size: 1.5rem;
29+
font-weight: 500;
30+
}
31+
.logo {
32+
height: 2rem;
33+
padding-bottom: 0.2rem;
34+
vertical-align: middle;
35+
margin-right: 0.8rem;
36+
}
37+
</style>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<span class="latex">L<span>a</span>T<span>e</span>X</span>
3+
</template>
4+
5+
<style scoped>
6+
/* LaTeX logo */
7+
.latex span {
8+
text-transform: uppercase;
9+
}
10+
11+
.latex span:first-child {
12+
font-size: 0.8em;
13+
vertical-align: 0.2em;
14+
margin-left: -0.4em;
15+
margin-right: -0.1em;
16+
}
17+
18+
.latex span:last-child {
19+
margin-left: -0.2em;
20+
margin-right: -0.1em;
21+
position: relative;
22+
top: 0.45ex;
23+
}
24+
</style>

0 commit comments

Comments
 (0)