Commit 42cd1c09de
Unsigned
Layout: unified · split
docs/.vitepress/plugins/urlSearchPlugin.ts +21
| @@ -53,6 +53,7 @@ function extractSearchMetadataFromMarkdown( | |||
| 53 | headings: string[] | 53 | headings: string[] |
| 54 | }[] = [] | 54 | }[] = [] |
| 55 | let currentAnchor = '' | 55 | let currentAnchor = '' |
| 56 | let extrepoEntryName: string | null = null | ||
| 56 | 57 | ||
| 57 | const body = src.startsWith('---') | 58 | const body = src.startsWith('---') |
| 58 | ? src.replace(/^---[\s\S]*?---\n?/, '') | 59 | ? src.replace(/^---[\s\S]*?---\n?/, '') |
| @@ -137,6 +138,26 @@ function extractSearchMetadataFromMarkdown( | |||
| 137 | tabPath.length = getTabsDepth() | 138 | tabPath.length = getTabsDepth() |
| 138 | const resetState = tabResetStack.pop() | 139 | const resetState = tabResetStack.pop() |
| 139 | if (resetState) restoreHeadingState(resetState) | 140 | if (resetState) restoreHeadingState(resetState) |
| 141 | } else if (closed === 'extrepo') { | ||
| 142 | extrepoEntryName = null | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | if (containerStack.includes('extrepo') && !containerStack.includes('tabs')) { | ||
| 147 | const extrepoHeadingMatch = line.match(/^\s*==\s+(.+)$/) | ||
| 148 | if (extrepoHeadingMatch) { | ||
| 149 | extrepoEntryName = extrepoHeadingMatch[1].trim() | ||
| 150 | continue | ||
| 151 | } | ||
| 152 | |||
| 153 | if (extrepoEntryName) { | ||
| 154 | const fieldMatch = line.match( | ||
| 155 | /^\s*-\s*(?:url|raw|src|manga|anime|novel)\s*:\s*(\S+)/ | ||
| 156 | ) | ||
| 157 | if (fieldMatch) { | ||
| 158 | pushLink(fieldMatch[1].trim(), extrepoEntryName) | ||
| 159 | continue | ||
| 160 | } | ||
| 140 | } | 161 | } |
| 141 | } | 162 | } |
| 142 | 163 | ||
docs/.vitepress/theme/components/Search.vue +2
| @@ -63,6 +63,7 @@ import { LRUCache } from '../composables/search/lru-cache' | |||
| 63 | import { createSearchTranslate } from '../composables/search/translation' | 63 | import { createSearchTranslate } from '../composables/search/translation' |
| 64 | import { useData } from '../composables/search/use-data' | 64 | import { useData } from '../composables/search/use-data' |
| 65 | import { useEffects } from '../composables/useEffects' | 65 | import { useEffects } from '../composables/useEffects' |
| 66 | import { registerGlobalComponents } from '../globalComponents' | ||
| 66 | import { enhanceAppWithTabs } from './tabs' | 67 | import { enhanceAppWithTabs } from './tabs' |
| 67 | 68 | ||
| 68 | export interface FooterTranslations { | 69 | export interface FooterTranslations { |
| @@ -1298,6 +1299,7 @@ function buildDocExcerpt(docId: string): Promise<void> { | |||
| 1298 | const app = createApp(comp) | 1299 | const app = createApp(comp) |
| 1299 | app.config.warnHandler = () => {} | 1300 | app.config.warnHandler = () => {} |
| 1300 | enhanceAppWithTabs(app, { renderAll: true }) | 1301 | enhanceAppWithTabs(app, { renderAll: true }) |
| 1302 | registerGlobalComponents(app) | ||
| 1301 | app.provide(dataSymbol, vitePressData) | 1303 | app.provide(dataSymbol, vitePressData) |
| 1302 | Object.defineProperties(app.config.globalProperties, { | 1304 | Object.defineProperties(app.config.globalProperties, { |
| 1303 | $frontmatter: { | 1305 | $frontmatter: { |
docs/.vitepress/theme/globalComponents.ts added +24
| @@ -0,0 +1,24 @@ | |||
| 1 | import type { App } from 'vue' | ||
| 2 | import Authors from './components/Authors.vue' | ||
| 3 | import Block from './components/Block.vue' | ||
| 4 | import Collapsible from './components/Collapsible.vue' | ||
| 5 | import { ExtensionRepos } from './components/extrepo' | ||
| 6 | import Fb from './components/Fb.vue' | ||
| 7 | import Feedback from './components/Feedback.vue' | ||
| 8 | import Highlight from './components/Highlight.vue' | ||
| 9 | import LinkInline from './components/LinkInline.vue' | ||
| 10 | import ScrapeTable from './components/ScrapeTable.vue' | ||
| 11 | import Tooltip from './components/Tooltip.vue' | ||
| 12 | |||
| 13 | export function registerGlobalComponents(app: App) { | ||
| 14 | app.component('LinkInline', LinkInline) | ||
| 15 | app.component('hl', Highlight) | ||
| 16 | app.component('Block', Block) | ||
| 17 | app.component('Authors', Authors) | ||
| 18 | app.component('Tooltip', Tooltip) | ||
| 19 | app.component('Feedback', Feedback) | ||
| 20 | app.component('fb', Fb) | ||
| 21 | app.component('Collapsible', Collapsible) | ||
| 22 | app.component('ScrapeTable', ScrapeTable) | ||
| 23 | app.component('ExtensionRepos', ExtensionRepos) | ||
| 24 | } | ||
docs/.vitepress/theme/index.ts +2 −20
| @@ -13,22 +13,13 @@ import FloatingVue from 'floating-vue' | |||
| 13 | import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css' | 13 | import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css' |
| 14 | import '@nolebase/vitepress-plugin-page-properties/client/style.css' | 14 | import '@nolebase/vitepress-plugin-page-properties/client/style.css' |
| 15 | import 'floating-vue/dist/style.css' | 15 | import 'floating-vue/dist/style.css' |
| 16 | import Authors from './components/Authors.vue' | ||
| 17 | import Tooltip from './components/Tooltip.vue' | ||
| 18 | import { createMediumZoomProvider } from './composables/medium-zoom' | 16 | import { createMediumZoomProvider } from './composables/medium-zoom' |
| 19 | import 'virtual:uno.css' | 17 | import 'virtual:uno.css' |
| 20 | import Collapsible from './components/Collapsible.vue' | ||
| 21 | import { ExtensionRepos } from './components/extrepo' | ||
| 22 | import Fb from './components/Fb.vue' | ||
| 23 | import Feedback from './components/Feedback.vue' | ||
| 24 | import ScrapeTable from './components/ScrapeTable.vue' | ||
| 25 | import Layout from './Layout.vue' | 18 | import Layout from './Layout.vue' |
| 26 | import './styles/tooltip-hint.css' | 19 | import './styles/tooltip-hint.css' |
| 27 | import './styles/steps.css' | 20 | import './styles/steps.css' |
| 28 | import Block from './components/Block.vue' | ||
| 29 | import Highlight from './components/Highlight.vue' | ||
| 30 | import LinkInline from './components/LinkInline.vue' | ||
| 31 | import { enhanceAppWithTabs } from './components/tabs' | 21 | import { enhanceAppWithTabs } from './components/tabs' |
| 22 | import { registerGlobalComponents } from './globalComponents' | ||
| 32 | 23 | ||
| 33 | export default { | 24 | export default { |
| 34 | extends: DefaultTheme, | 25 | extends: DefaultTheme, |
| @@ -50,16 +41,7 @@ export default { | |||
| 50 | } | 41 | } |
| 51 | }) | 42 | }) |
| 52 | enhanceAppWithTabs(app) | 43 | enhanceAppWithTabs(app) |
| 53 | app.component('LinkInline', LinkInline) | 44 | registerGlobalComponents(app) |
| 54 | app.component('hl', Highlight) | ||
| 55 | app.component('Block', Block) | ||
| 56 | app.component('Authors', Authors) | ||
| 57 | app.component('Tooltip', Tooltip) | ||
| 58 | app.component('Feedback', Feedback) | ||
| 59 | app.component('fb', Fb) | ||
| 60 | app.component('Collapsible', Collapsible) | ||
| 61 | app.component('ScrapeTable', ScrapeTable) | ||
| 62 | app.component('ExtensionRepos', ExtensionRepos) | ||
| 63 | createMediumZoomProvider(app, router) | 45 | createMediumZoomProvider(app, router) |
| 64 | app.use( | 46 | app.use( |
| 65 | NolebasePagePropertiesPlugin<{ tags: string[]; progress: number }>(), | 47 | NolebasePagePropertiesPlugin<{ tags: string[]; progress: number }>(), |