1
0
mirror of https://github.com/sendevia/website.git synced 2026-03-05 23:32:45 +08:00
This commit is contained in:
2024-07-12 22:27:58 +08:00
commit d823026b48
9 changed files with 214 additions and 0 deletions

6
.gitignore vendored Executable file
View File

@@ -0,0 +1,6 @@
.vscode
*.code-workspace
*.map
node_modules
package-lock.json
cache/

15
.vitepress/config.mts Normal file
View File

@@ -0,0 +1,15 @@
import { defineConfig } from "vitepress";
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "sendevia 的小站",
titleTemplate: ":title - sendevia.page.vitpress",
description: "A VitePress Site",
lang: "zh_CN",
cleanUrls: true,
markdown: {
image: {
lazyLoading: true,
},
},
});

View File

@@ -0,0 +1,28 @@
<script setup lang="ts">
import { useData } from 'vitepress'
// https://vitepress.dev/reference/runtime-api#usedata
const { site, page, frontmatter } = useData()
</script>
<template>
<div v-if="frontmatter.home">
<h1>{{ site.title }}</h1>
<p>{{ site.description }}</p>
<ul>
<li><a href="/markdown-examples.html">Markdown Examples</a></li>
<li><a href="/api-examples.html">API Examples</a></li>
</ul>
</div>
<div v-if="page.isNotFound">
<a href="/">Home</a>
<p>404!</p>
</div>
<div v-else>
<a href="/">Home</a>
<Content />
</div>
</template>

11
.vitepress/theme/index.ts Normal file
View File

@@ -0,0 +1,11 @@
// https://vitepress.dev/guide/custom-theme
import Layout from "./Layout.vue";
import type { Theme } from "vitepress";
import "./style.css";
export default {
Layout,
enhanceApp({ app, router, siteData }) {
// ...
},
} satisfies Theme;

View File

@@ -0,0 +1,3 @@
html {
font-family: Arial, Helvetica;
}

52
api-examples.md Normal file
View File

@@ -0,0 +1,52 @@
---
outline: deep
---
# Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
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:
```md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```
<script setup>
import { useData } from 'vitepress'
const { site, theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
## More
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

4
index.md Normal file
View File

@@ -0,0 +1,4 @@
---
home: true
---

85
markdown-examples.md Normal file
View File

@@ -0,0 +1,85 @@
# Markdown Extension Examples
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````md
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

10
package.json Normal file
View File

@@ -0,0 +1,10 @@
{
"scripts": {
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview"
},
"devDependencies": {
"vue": "^3.4.31"
}
}