fix(theme): local search showDetailedList not working in windows (#2248)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/2253/head
烽宁 1 year ago committed by GitHub
parent e91e0f91b2
commit 8354f8fb86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -26,6 +26,7 @@ import {
} from 'vue'
import type { ModalTranslations } from '../../../../types/local-search'
import { pathToFile } from '../../app/utils'
import { slash } from '../../shared'
import { useData } from '../composables/data'
import { createTranslate } from '../support/translation'
@ -199,7 +200,7 @@ debouncedWatch(
)
async function fetchExcerpt(id: string) {
const file = pathToFile(id.slice(0, id.indexOf('#')))
const file = slash(pathToFile(id.slice(0, id.indexOf('#'))))
try {
return { id, mod: await import(/*@vite-ignore*/ file) }
} catch (e) {

@ -7,11 +7,10 @@ import {
type UserConfig as ViteUserConfig
} from 'vite'
import type { GetModuleInfo, RollupOutput } from 'rollup'
import { slash } from '../utils/slash'
import type { SiteConfig } from '../config'
import { APP_PATH } from '../alias'
import { createVitePressPlugin } from '../plugin'
import { sanitizeFileName } from '../shared'
import { sanitizeFileName, slash } from '../shared'
import { buildMPAClient } from './buildMPAClient'
import { fileURLToPath } from 'url'
import { normalizePath } from 'vite'

@ -12,11 +12,11 @@ import {
notFoundPageData,
resolveSiteDataByRoute,
sanitizeFileName,
slash,
type HeadConfig,
type PageData,
type SSGContext
} from '../shared'
import { slash } from '../utils/slash'
import { deserializeFunctions } from '../utils/fnSerialize'
export async function renderPage(

@ -11,9 +11,13 @@ import {
type MarkdownOptions,
type MarkdownRenderer
} from './markdown'
import { EXTERNAL_URL_RE, type HeadConfig, type PageData } from './shared'
import {
EXTERNAL_URL_RE,
slash,
type HeadConfig,
type PageData
} from './shared'
import { getGitTimestamp } from './utils/getGitTimestamp'
import { slash } from './utils/slash'
const debug = _debug('vitepress:md')
const cache = new LRUCache<string, MarkdownCompileResult>({ max: 1024 })

@ -1,6 +1,5 @@
import path from 'path'
import c from 'picocolors'
import { slash } from './utils/slash'
import type { OutputAsset, OutputChunk } from 'rollup'
import {
mergeConfig,
@ -17,7 +16,7 @@ import {
} from './alias'
import { resolveUserConfig, resolvePages, type SiteConfig } from './config'
import { clearCache, createMarkdownToVueRenderFn } from './markdownToVue'
import type { PageDataPayload } from './shared'
import { slash, type PageDataPayload } from './shared'
import { staticDataPlugin } from './plugins/staticDataPlugin'
import { webFontsPlugin } from './plugins/webFontsPlugin'
import { dynamicRoutesPlugin } from './plugins/dynamicRoutesPlugin'

@ -1,3 +0,0 @@
export function slash(p: string): string {
return p.replace(/\\/g, '/')
}

@ -165,3 +165,7 @@ export function sanitizeFileName(name: string): string {
.replace(/(^|\/)_+(?=[^/]*$)/, '$1')
)
}
export function slash(p: string): string {
return p.replace(/\\/g, '/')
}

Loading…
Cancel
Save