@@ -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 = {
@@ -157,6 +160,15 @@ function getGuideSidebar(): DefaultTheme.SidebarGroup[] {
157
160
} ,
158
161
] ,
159
162
} ,
163
+ {
164
+ text : 'Documenting Iroha' ,
165
+ items : [
166
+ {
167
+ text : 'Code snippets' ,
168
+ link : '/documenting/snippets' ,
169
+ } ,
170
+ ] ,
171
+ } ,
160
172
]
161
173
}
162
174
@@ -172,7 +184,7 @@ export default defineConfig({
172
184
lang : 'en-US' ,
173
185
vite : {
174
186
plugins : [
175
- Windi ( { config : path . resolve ( __dirname , '../windi.config.ts' ) } ) ,
187
+ Windi ( { config : resolve ( __dirname , '../windi.config.ts' ) } ) ,
176
188
VitePWA ( {
177
189
// Based on: https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs
178
190
manifest : {
@@ -193,6 +205,7 @@ export default defineConfig({
193
205
strategies : 'injectManifest' ,
194
206
injectRegister : false ,
195
207
} ) ,
208
+ svgLoader ( )
196
209
] ,
197
210
} ,
198
211
lastUpdated : true ,
@@ -205,8 +218,14 @@ export default defineConfig({
205
218
] ,
206
219
207
220
markdown : {
208
- config ( md ) {
221
+ async config ( md ) {
209
222
md . use ( footnote )
223
+ snippets_plugin ( md , {
224
+ 'snippet_root' : resolve ( __dirname , '../src/snippets/' ) ,
225
+ 'highlighter' : await getHighlighter ( {
226
+ theme : "github-light"
227
+ } )
228
+ } )
210
229
} ,
211
230
} ,
212
231
0 commit comments