File tree Expand file tree Collapse file tree 6 files changed +33
-5
lines changed
Expand file tree Collapse file tree 6 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ yarn.lock
55/dist
66
77docs /.vitepress /cache /
8-
8+ docs / .vitepress / dist /
99* .mov
1010
1111test /
Original file line number Diff line number Diff line change 1010
1111``` shell
1212yarn docs:dev
13- // 浏览器打开
14- http://localhost:5173
13+ ```
14+ 浏览器打开 http://localhost:5173
15+
16+ ## 部署
17+
18+ ``` shell
19+ yarn docs:build
20+ ```
21+
22+ 本地预览,执行下列命令后,浏览器打开 http://localhost:4173
23+ ``` shell
24+ yarn docs:preview
1525```
1626
Original file line number Diff line number Diff line change 11import { defineConfig } from "vitepress" ;
22import { ChapterItems , Chapters } from "./theme/constrants/route" ;
3+ import autoH1 from "./plugins/autoH1" ;
34
45// https://vitepress.dev/reference/site-config
56export default defineConfig ( {
@@ -48,5 +49,8 @@ export default defineConfig({
4849 toc : {
4950 level : [ 1 , 2 , 3 , 4 ] ,
5051 } ,
52+ config : ( md ) => {
53+ md . use ( autoH1 ) ;
54+ } ,
5155 } ,
5256} ) ;
Original file line number Diff line number Diff line change 1+ export default ( md ) => {
2+ const hasH1 = ( content ) => / ^ \s * # \s + .+ / m. test ( content ) ;
3+
4+ md . core . ruler . before ( "normalize" , "auto_add_h1" , ( state ) => {
5+ const { frontmatter } = state . env ;
6+ const src = state . src ;
7+ if ( frontmatter ?. title && ! hasH1 ( src ) ) {
8+ state . src = `# ${ frontmatter . title } \n\n` + src ;
9+ }
10+ return false ;
11+ } ) ;
12+ } ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const { Layout } = DefaultTheme;
66
77<template >
88 <Layout >
9+ <!-- <template #not-found> 404 not-found </template> -->
910 <!-- <template #home-hero-image> </template> -->
1011 </Layout >
1112</template >
Original file line number Diff line number Diff line change 11---
22title : 通过 API 来绑定设备
33---
4+
45## 1. 用户注册
56
67``` plain
@@ -227,6 +228,6 @@ authorization Bearer 4fxxxxxxxxxxxxxxxxxxxxxxx
227228
228229```
229230
230- # 11. 声音复刻
231+ ## 11. 声音复刻
231232
232- 见 [ 声音复刻] ( ./voice-clone.md )
233+ 见 [ 声音复刻] ( ./voice-clone.md )
You can’t perform that action at this time.
0 commit comments