Skip to content

Commit 0d2479a

Browse files
committed
vitepress-init
1 parent 33c8183 commit 0d2479a

File tree

8 files changed

+189
-1
lines changed

8 files changed

+189
-1
lines changed

docs/.vitepress/config.mts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: "Goldfish",
6+
description: "A functional programming language"
7+
})

docs/.vitepress/theme/Layout.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<script setup lang="ts">
2+
import { useData } from 'vitepress'
3+
4+
// https://vitepress.dev/reference/runtime-api#usedata
5+
const { site, frontmatter } = useData()
6+
</script>
7+
8+
<template>
9+
<div v-if="frontmatter.home">
10+
<h1>{{ site.title }}</h1>
11+
<p>{{ site.description }}</p>
12+
<ul>
13+
<li><a href="/markdown-examples.html">Markdown Examples</a></li>
14+
<li><a href="/api-examples.html">API Examples</a></li>
15+
</ul>
16+
</div>
17+
<div v-else>
18+
<a href="/">Home</a>
19+
<Content />
20+
</div>
21+
</template>

docs/.vitepress/theme/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import Layout from './Layout.vue'
3+
import type { Theme } from 'vitepress'
4+
import './style.css'
5+
6+
export default {
7+
Layout,
8+
enhanceApp({ app, router, siteData }) {
9+
// ...
10+
}
11+
} satisfies Theme
12+

docs/.vitepress/theme/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
html {
3+
font-family: Arial, Helvetica;
4+
}
5+

docs/api-examples.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Runtime API Examples
6+
7+
This page demonstrates usage of some of the runtime APIs provided by VitePress.
8+
9+
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
10+
11+
```md
12+
<script setup>
13+
import { useData } from 'vitepress'
14+
15+
const { theme, page, frontmatter } = useData()
16+
</script>
17+
18+
## Results
19+
20+
### Theme Data
21+
<pre>{{ theme }}</pre>
22+
23+
### Page Data
24+
<pre>{{ page }}</pre>
25+
26+
### Page Frontmatter
27+
<pre>{{ frontmatter }}</pre>
28+
```
29+
30+
<script setup>
31+
import { useData } from 'vitepress'
32+
33+
const { site, theme, page, frontmatter } = useData()
34+
</script>
35+
36+
## Results
37+
38+
### Theme Data
39+
<pre>{{ theme }}</pre>
40+
41+
### Page Data
42+
<pre>{{ page }}</pre>
43+
44+
### Page Frontmatter
45+
<pre>{{ frontmatter }}</pre>
46+
47+
## More
48+
49+
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

docs/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
home: true
3+
---
4+

docs/markdown-examples.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Markdown Extension Examples
2+
3+
This page demonstrates some of the built-in markdown extensions provided by VitePress.
4+
5+
## Syntax Highlighting
6+
7+
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
8+
9+
**Input**
10+
11+
````md
12+
```js{4}
13+
export default {
14+
data () {
15+
return {
16+
msg: 'Highlighted!'
17+
}
18+
}
19+
}
20+
```
21+
````
22+
23+
**Output**
24+
25+
```js{4}
26+
export default {
27+
data () {
28+
return {
29+
msg: 'Highlighted!'
30+
}
31+
}
32+
}
33+
```
34+
35+
## Custom Containers
36+
37+
**Input**
38+
39+
```md
40+
::: info
41+
This is an info box.
42+
:::
43+
44+
::: tip
45+
This is a tip.
46+
:::
47+
48+
::: warning
49+
This is a warning.
50+
:::
51+
52+
::: danger
53+
This is a dangerous warning.
54+
:::
55+
56+
::: details
57+
This is a details block.
58+
:::
59+
```
60+
61+
**Output**
62+
63+
::: info
64+
This is an info box.
65+
:::
66+
67+
::: tip
68+
This is a tip.
69+
:::
70+
71+
::: warning
72+
This is a warning.
73+
:::
74+
75+
::: danger
76+
This is a dangerous warning.
77+
:::
78+
79+
::: details
80+
This is a details block.
81+
:::
82+
83+
## More
84+
85+
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
"devDependencies": {
99
"vitepress": "^2.0.0-alpha.17",
1010
"vue": "^3.5.32"
11+
},
12+
"scripts": {
13+
"docs:dev": "vitepress dev docs",
14+
"docs:build": "vitepress build docs",
15+
"docs:preview": "vitepress preview docs"
1116
}
12-
}
17+
}

0 commit comments

Comments
 (0)