11import { cwd , env } from 'node:process'
2+
23import { type DefaultTheme , defineConfig } from 'vitepress'
34import MarkdownItFootnote from 'markdown-it-footnote'
45
56import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
7+
68import { BiDirectionalLinks } from '@nolebase/markdown-it-bi-directional-links'
7- import type { Options as ElementTransformOptions } from '@nolebase/markdown-it-element-transform'
89import { ElementTransform } from '@nolebase/markdown-it-element-transform'
910import { buildEndGenerateOpenGraphImages } from '@nolebase/vitepress-plugin-og-image'
11+ import { UnlazyImages } from '@nolebase/markdown-it-unlazy-img'
1012
1113export const sidebars : Record < string , DefaultTheme . Sidebar > = {
1214 'en' : {
@@ -37,17 +39,12 @@ export const sidebars: Record<string, DefaultTheme.Sidebar> = {
3739 { text : 'Overview' , link : '/pages/en/integrations/' } ,
3840 ] ,
3941 } ,
40- {
41- text : 'Obsidian Plugins' ,
42- items : [
43- { text : 'UnoCSS' , link : '/pages/en/integrations/obsidian-plugin-unocss/' } ,
44- ] ,
45- } ,
4642 {
4743 text : 'Markdown It Plugins' ,
4844 items : [
4945 { text : 'Bi-directional links' , link : '/pages/en/integrations/markdown-it-bi-directional-links/' } ,
5046 { text : 'Elements Transformation' , link : '/pages/en/integrations/markdown-it-element-transform/' } ,
47+ { text : 'Lazy loading blurred thumbnails' , link : '/pages/en/integrations/markdown-it-unlazy-img/' } ,
5148 ] ,
5249 } ,
5350 {
@@ -59,7 +56,20 @@ export const sidebars: Record<string, DefaultTheme.Sidebar> = {
5956 { text : 'Changelog & File history' , link : '/pages/en/integrations/vitepress-plugin-git-changelog/' } ,
6057 { text : 'Page properties' , link : '/pages/en/integrations/vitepress-plugin-page-properties/' } ,
6158 { text : 'Previewing image (social media card) generation' , link : '/pages/en/integrations/vitepress-plugin-og-image/' } ,
62- { text : 'Enhanced <mark> elements' , link : '/pages/en/integrations/vitepress-plugin-enhanced-mark/' } ,
59+ { text : 'Enhanced mark elements' , link : '/pages/en/integrations/vitepress-plugin-enhanced-mark/' } ,
60+ {
61+ text : 'Thumbnail hashing for images' ,
62+ items : [
63+ { text : 'Usage' , link : '/pages/en/integrations/vitepress-plugin-thumbnail-hash/' } ,
64+ { text : 'Try ThumbHash' , link : '/pages/en/integrations/vitepress-plugin-thumbnail-hash/thumbhash' } ,
65+ ] ,
66+ } ,
67+ ] ,
68+ } ,
69+ {
70+ text : 'Obsidian Plugins' ,
71+ items : [
72+ { text : 'UnoCSS' , link : '/pages/en/integrations/obsidian-plugin-unocss/' } ,
6373 ] ,
6474 } ,
6575 ] ,
@@ -119,17 +129,12 @@ export const sidebars: Record<string, DefaultTheme.Sidebar> = {
119129 { text : '概览' , link : '/pages/zh-CN/integrations/' } ,
120130 ] ,
121131 } ,
122- {
123- text : 'Obsidian 插件' ,
124- items : [
125- { text : 'UnoCSS' , link : '/pages/zh-CN/integrations/obsidian-plugin-unocss/' } ,
126- ] ,
127- } ,
128132 {
129133 text : 'Markdown It 插件' ,
130134 items : [
131135 { text : '双向链接' , link : '/pages/zh-CN/integrations/markdown-it-bi-directional-links/' } ,
132136 { text : '元素转换' , link : '/pages/zh-CN/integrations/markdown-it-element-transform/' } ,
137+ { text : '懒加载模糊缩略图' , link : '/pages/zh-CN/integrations/markdown-it-unlazy-img/' } ,
133138 ] ,
134139 } ,
135140 {
@@ -141,7 +146,20 @@ export const sidebars: Record<string, DefaultTheme.Sidebar> = {
141146 { text : '变更日志 及 文件历史' , link : '/pages/zh-CN/integrations/vitepress-plugin-git-changelog/' } ,
142147 { text : '页面属性' , link : '/pages/zh-CN/integrations/vitepress-plugin-page-properties/' } ,
143148 { text : '预览图片(社交媒体卡片)生成' , link : '/pages/zh-CN/integrations/vitepress-plugin-og-image/' } ,
144- { text : '<mark> 元素增强' , link : '/pages/zh-CN/integrations/vitepress-plugin-enhanced-mark/' } ,
149+ { text : 'mark 元素增强' , link : '/pages/zh-CN/integrations/vitepress-plugin-enhanced-mark/' } ,
150+ {
151+ text : '缩略图模糊哈希生成' ,
152+ items : [
153+ { text : '用法' , link : '/pages/zh-CN/integrations/vitepress-plugin-thumbnail-hash/' } ,
154+ { text : '尝试 ThumbHash' , link : '/pages/zh-CN/integrations/vitepress-plugin-thumbnail-hash/thumbhash' } ,
155+ ] ,
156+ } ,
157+ ] ,
158+ } ,
159+ {
160+ text : 'Obsidian 插件' ,
161+ items : [
162+ { text : 'UnoCSS' , link : '/pages/zh-CN/integrations/obsidian-plugin-unocss/' } ,
145163 ] ,
146164 } ,
147165 ] ,
@@ -191,6 +209,13 @@ export default defineConfig({
191209 __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ : getVueProdHydrationMismatchDetailsFlag ( ) ,
192210 } ,
193211 } ,
212+ vue : {
213+ template : {
214+ transformAssetUrls : {
215+ NolebaseUnlazyImg : [ 'src' ] ,
216+ } ,
217+ } ,
218+ } ,
194219 lastUpdated : true ,
195220 themeConfig : {
196221 outline : 'deep' ,
@@ -260,12 +285,16 @@ export default defineConfig({
260285 errorRendering : 'hover' ,
261286 } ) ,
262287 ] ,
263- config ( md ) {
264- md . use ( MarkdownItFootnote )
288+ preConfig ( md ) {
265289 md . use ( BiDirectionalLinks ( {
266290 dir : cwd ( ) ,
267291 } ) )
268-
292+ md . use ( UnlazyImages ( ) , {
293+ imgElementTag : 'NolebaseUnlazyImg' ,
294+ } )
295+ } ,
296+ config ( md ) {
297+ md . use ( MarkdownItFootnote )
269298 md . use ( ElementTransform , ( ( ) => {
270299 let transformNextLinkCloseToken = false
271300
@@ -287,7 +316,7 @@ export default defineConfig({
287316 break
288317 }
289318 } ,
290- } as ElementTransformOptions
319+ }
291320 } ) ( ) )
292321 } ,
293322 } ,
@@ -299,15 +328,17 @@ export default defineConfig({
299328 { prefix : '/pages/en/integrations/markdown-it' , text : 'Markdown It Plugins' } ,
300329 { prefix : '/pages/en/integrations/obsidian-plugin' , text : 'Obsidian Plugins' } ,
301330 { prefix : '/pages/en/integrations/vitepress-plugin' , text : 'VitePress Plugins' } ,
331+ { prefix : '/pages/en/integrations/vitepress-plugin/vitepress-plugin-thumbnail-hash' , text : 'VitePress Plugin: Thumbnail hashing for images' } ,
302332 { prefix : '/pages/en/integrations/' , text : 'Integrations' } ,
303333 { prefix : '/pages/en/guide/' , text : 'Guide' } ,
304334 { prefix : '/pages/en/ui/' , text : 'UI Components' } ,
305335 { prefix : '/pages/en/' , text : 'Documentations' } ,
306336 { prefix : '/pages/zh-CN/integrations/markdown-it' , text : 'Markdown It 插件' } ,
307337 { prefix : '/pages/zh-CN/integrations/obsidian-plugin' , text : 'Obsidian 插件' } ,
308338 { prefix : '/pages/zh-CN/integrations/vitepress-plugin' , text : 'VitePress 插件' } ,
309- { prefix : '/pages/zh-CN/guide/ ' , text : '指南 ' } ,
339+ { prefix : '/pages/zh-CN/integrations/vitepress-plugin/vitepress-plugin-thumbnail-hash ' , text : 'VitePress 插件:缩略图模糊哈希生成 ' } ,
310340 { prefix : '/pages/zh-CN/integrations/' , text : '集成' } ,
341+ { prefix : '/pages/zh-CN/guide/' , text : '指南' } ,
311342 { prefix : '/pages/zh-CN/ui/' , text : 'UI 组件' } ,
312343 { prefix : '/pages/zh-CN/' , text : '文档' } ,
313344 ] ,
0 commit comments