@@ -2,8 +2,11 @@ import { defineConfig, UserConfig, DefaultTheme } from 'vitepress'
2
2
import Windi from 'vite-plugin-windicss'
3
3
import footnote from 'markdown-it-footnote'
4
4
import customHighlight from './plugins/highlight'
5
- import path from 'path'
5
+ import { resolve } from 'path'
6
6
import { VitePWA } from 'vite-plugin-pwa'
7
+ import { snippets_plugin } from './snippet_tabs'
8
+ import svgLoader from 'vite-svg-loader'
9
+ import { getHighlighter } from "shiki" ;
7
10
8
11
async function themeConfig ( ) {
9
12
const cfg : UserConfig = {
@@ -165,6 +168,15 @@ function getGuideSidebar(): DefaultTheme.SidebarGroup[] {
165
168
} ,
166
169
] ,
167
170
} ,
171
+ {
172
+ text : 'Documenting Iroha' ,
173
+ items : [
174
+ {
175
+ text : 'Code snippets' ,
176
+ link : '/documenting/snippets' ,
177
+ } ,
178
+ ] ,
179
+ } ,
168
180
]
169
181
}
170
182
@@ -180,7 +192,7 @@ export default defineConfig({
180
192
lang : 'en-US' ,
181
193
vite : {
182
194
plugins : [
183
- Windi ( { config : path . resolve ( __dirname , '../windi.config.ts' ) } ) ,
195
+ Windi ( { config : resolve ( __dirname , '../windi.config.ts' ) } ) ,
184
196
VitePWA ( {
185
197
// Based on: https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs
186
198
manifest : {
@@ -201,6 +213,7 @@ export default defineConfig({
201
213
strategies : 'injectManifest' ,
202
214
injectRegister : false ,
203
215
} ) ,
216
+ svgLoader ( )
204
217
] ,
205
218
} ,
206
219
lastUpdated : true ,
@@ -213,8 +226,14 @@ export default defineConfig({
213
226
] ,
214
227
215
228
markdown : {
216
- config ( md ) {
229
+ async config ( md ) {
217
230
md . use ( footnote )
231
+ snippets_plugin ( md , {
232
+ 'snippet_root' : resolve ( __dirname , '../src/snippets/' ) ,
233
+ 'highlighter' : await getHighlighter ( {
234
+ theme : "github-light"
235
+ } )
236
+ } )
218
237
} ,
219
238
} ,
220
239
0 commit comments