@@ -6,126 +6,127 @@ import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
66import markdownItKdb from 'markdown-it-kbd'
77import markdownItImplicitFigures from 'markdown-it-implicit-figures'
88
9+ /* Markdown */
10+ import linkBlock from '../theme/composables/linkBlock'
11+
912import * as config from '../config.json'
1013
1114/* GitLog */
1215import UnoCSS from 'unocss/vite'
13- import {
14- GitChangelog ,
15- GitChangelogMarkdownSection
16- } from '@nolebase/vitepress-plugin-git-changelog/vite'
16+ import { GitChangelog , GitChangelogMarkdownSection } from '@nolebase/vitepress-plugin-git-changelog/vite'
1717
1818import { NolebaseGitChangelogOptions , YandexMetrikaOptions } from './plugins/index'
1919
2020export const shared = defineConfig ( {
21- srcDir : './docs' ,
22- cleanUrls : true ,
23- head : [
24- [ 'link' , { rel : 'icon' , type : 'image/x-icon' , href : '/favicon.ico' } ] ,
25- [ 'link' , { rel : 'icon' , type : 'image/png' , href : '/favicon.png' } ] ,
26- [ 'meta' , { name : 'theme-color' , content : config . head . themeColor } ] ,
27- [ 'meta' , { name : 'og:type' , content : config . head . type } ] ,
28- [ 'meta' , { name : 'og:site_name' , content : config . title } ] ,
29- [ 'meta' , { name : 'og:image' , content : config . host + config . head . ogImage } ] ,
30- [ 'meta' , { name : 'twitter:card' , content : 'summary_large_image' } ] ,
31- [ 'meta' , { name : 'twitter:image' , content : config . host + config . head . ogImage } ] ,
32- [ 'meta' , { name : 'yandex-verification' , content : YandexMetrikaOptions . webmaster . id } ]
21+ srcDir : './docs' ,
22+ cleanUrls : true ,
23+ head : [
24+ [ 'link' , { rel : 'icon' , type : 'image/x-icon' , href : '/favicon.ico' } ] ,
25+ [ 'link' , { rel : 'icon' , type : 'image/png' , href : '/favicon.png' } ] ,
26+ [ 'meta' , { name : 'theme-color' , content : config . head . themeColor } ] ,
27+ [ 'meta' , { name : 'og:type' , content : config . head . type } ] ,
28+ [ 'meta' , { name : 'og:site_name' , content : config . title } ] ,
29+ [ 'meta' , { name : 'og:image' , content : config . host + config . head . ogImage } ] ,
30+ [ 'meta' , { name : 'twitter:card' , content : 'summary_large_image' } ] ,
31+ [ 'meta' , { name : 'twitter:image' , content : config . host + config . head . ogImage } ] ,
32+ [ 'meta' , { name : 'yandex-verification' , content : YandexMetrikaOptions . webmaster . id } ]
33+ ] ,
34+ vite : {
35+ plugins : [
36+ UnoCSS ( ) ,
37+ GitChangelog ( NolebaseGitChangelogOptions . plugin ) ,
38+ GitChangelogMarkdownSection ( NolebaseGitChangelogOptions . pluginSections )
3339 ] ,
34- vite : {
35- plugins : [
36- UnoCSS ( ) ,
37- GitChangelog ( NolebaseGitChangelogOptions . plugin ) ,
38- GitChangelogMarkdownSection ( NolebaseGitChangelogOptions . pluginSections ) ,
39- ] ,
40- optimizeDeps : {
41- exclude : [ '@nolebase/vitepress-plugin-enhanced-readabilities/client' ]
42- } ,
43- ssr : {
44- noExternal : [
45- '@nolebase/vitepress-plugin-enhanced-readabilities' ,
46- '@nolebase/vitepress-plugin-page-properties'
47- ]
48- } ,
49- resolve : {
50- alias : {
51- '@vitepress/theme' : fileURLToPath (
52- new URL ( '../node_modules/vitepress/dist/client/theme-default' , import . meta. url )
53- )
54- }
55- }
40+ optimizeDeps : {
41+ exclude : [ '@nolebase/vitepress-plugin-enhanced-readabilities/client' ]
5642 } ,
57- sitemap : {
58- hostname : 'https://alt-kde.wiki'
43+ ssr : {
44+ noExternal : [
45+ '@nolebase/vitepress-plugin-enhanced-readabilities' ,
46+ '@nolebase/vitepress-plugin-page-properties'
47+ ]
5948 } ,
60- themeConfig : {
61- logo : { src : '/logo.png' , width : 36 , height : 36 , alt : "ALT KDE Wiki" } ,
62- search : {
63- provider : 'local' ,
64- options : {
65- locales : {
66- root : {
67- translations : {
68- button : {
69- buttonText : 'Поиск' ,
70- buttonAriaLabel : 'Поиск'
71- } ,
72- modal : {
73- noResultsText : 'Нет результатов по запросу' ,
74- resetButtonTitle : 'Сбросить' ,
75- footer : {
76- selectText : 'для выбора' ,
77- navigateText : 'для навигации' ,
78- closeText : 'закрыть'
79- }
80- }
81- }
82- }
49+ resolve : {
50+ alias : {
51+ '@vitepress/theme' : fileURLToPath (
52+ new URL ( '../node_modules/vitepress/dist/client/theme-default' , import . meta. url )
53+ )
54+ }
55+ }
56+ } ,
57+ sitemap : {
58+ hostname : 'https://alt-kde.wiki'
59+ } ,
60+ themeConfig : {
61+ logo : { src : '/logo.png' , width : 36 , height : 36 , alt : 'ALT KDE Wiki' } ,
62+ search : {
63+ provider : 'local' ,
64+ options : {
65+ locales : {
66+ root : {
67+ translations : {
68+ button : {
69+ buttonText : 'Поиск' ,
70+ buttonAriaLabel : 'Поиск'
71+ } ,
72+ modal : {
73+ noResultsText : 'Нет результатов по запросу' ,
74+ resetButtonTitle : 'Сбросить' ,
75+ footer : {
76+ selectText : 'для выбора' ,
77+ navigateText : 'для навигации' ,
78+ closeText : 'закрыть'
8379 }
80+ }
8481 }
85- } ,
86- socialLinks : [
87- {
88- icon : {
89- svg : telegram
90- } ,
91- link : 'https://t.me/alt_kde'
92- } ,
93- { icon : 'github' , link : 'https://github.com/OlegShchavelev/ALTRegularKDEWiki' }
94- ] ,
95- outline : {
96- level : [ 2 , 3 ] ,
97- } ,
82+ }
83+ }
84+ }
9885 } ,
99- markdown : {
100- container : {
101- tipLabel : 'Подсказка' ,
102- warningLabel : 'Внимание' ,
103- dangerLabel : 'Осторожно' ,
104- infoLabel : 'Информация' ,
105- detailsLabel : 'Подробнее' ,
86+ socialLinks : [
87+ {
88+ icon : {
89+ svg : telegram
10690 } ,
107- config ( md ) {
108- md . use ( tabsMarkdownPlugin )
109- md . use ( markdownItKdb )
110- md . use ( markdownItImplicitFigures , {
111- figcaption : 'title' ,
112- copyAttrs : '^class$'
113- } )
114- }
91+ link : 'https://t.me/alt_kde'
92+ } ,
93+ { icon : 'github' , link : 'https://github.com/OlegShchavelev/ALTRegularKDEWiki' }
94+ ] ,
95+ outline : {
96+ level : [ 2 , 3 ]
97+ }
98+ } ,
99+ markdown : {
100+ container : {
101+ tipLabel : 'Подсказка' ,
102+ warningLabel : 'Внимание' ,
103+ dangerLabel : 'Осторожно' ,
104+ infoLabel : 'Информация' ,
105+ detailsLabel : 'Подробнее'
115106 } ,
116- transformPageData : ( pageData ) => {
117- const canonicalUrl = `https://alt-kde.wiki/${ pageData . relativePath } `
118- . replace ( / i n d e x \. m d $ / , '' )
119- . replace ( / \. m d $ / , '.html' )
107+ config ( md ) {
108+ md . use ( tabsMarkdownPlugin )
109+ md . use ( markdownItKdb )
110+ md . use ( markdownItImplicitFigures , {
111+ figcaption : 'title' ,
112+ copyAttrs : '^class$'
113+ } )
114+ md . use ( linkBlock )
115+ }
116+ } ,
117+ transformPageData : ( pageData ) => {
118+ const canonicalUrl = `https://alt-kde.wiki/${ pageData . relativePath } `
119+ . replace ( / i n d e x \. m d $ / , '' )
120+ . replace ( / \. m d $ / , '.html' )
120121
121- pageData . frontmatter . head ??= [ ]
122+ pageData . frontmatter . head ??= [ ]
122123
123- pageData . frontmatter . head . push (
124- [ 'link' , { rel : 'canonical' , href : canonicalUrl } ] ,
125- [ 'meta' , { name : 'og:title' , content : pageData . title + config . head . titleSeponator + config . title } ] ,
126- )
127- if ( pageData . frontmatter . layout !== 'home' ) {
128- pageData . description = `Cтатья написанная простым языком: «${ pageData . title } » для ${ config . title } . Последнее обновление ${ config . title } : ${ new Date ( pageData . lastUpdated ?? new Date ( ) ) . toLocaleString ( 'ru-RU' ) } `
129- }
124+ pageData . frontmatter . head . push (
125+ [ 'link' , { rel : 'canonical' , href : canonicalUrl } ] ,
126+ [ 'meta' , { name : 'og:title' , content : pageData . title + config . head . titleSeponator + config . title } ]
127+ )
128+ if ( pageData . frontmatter . layout !== 'home' ) {
129+ pageData . description = `Cтатья написанная простым языком: «${ pageData . title } » для ${ config . title } . Последнее обновление ${ config . title } : ${ new Date ( pageData . lastUpdated ?? new Date ( ) ) . toLocaleString ( 'ru-RU' ) } `
130130 }
131- } )
131+ }
132+ } )
0 commit comments