]*(style=".*?")/
- const preRE = /^/
const vueRE = /-vue$/
const lineNoStartRE = /=(\d*)/
const lineNoRE = /:(no-)?line-numbers(=\d*)?$/
@@ -116,16 +126,6 @@ export async function highlight(
}
const lineOptions = attrsToLines(attrs)
- const cleanup = (str: string) => {
- return str
- .replace(
- preRE,
- (_, attributes) =>
- ``
- )
- .replace(styleRE, (_, style) => _.replace(style, ''))
- }
-
const mustaches = new Map()
const removeMustache = (s: string) => {
@@ -161,8 +161,17 @@ export async function highlight(
transformers: [
...transformers,
transformerCompactLineOptions(lineOptions),
+ {
+ name: 'vitepress:v-pre',
+ pre(node) {
+ if (vPre) node.properties['v-pre'] = ''
+ }
+ },
...userTransformers
],
+ meta: {
+ __raw: attrs
+ },
...(typeof theme === 'string' || 'name' in theme
? { theme }
: {
@@ -171,6 +180,6 @@ export async function highlight(
})
})
- return fillEmptyHighlightedLine(cleanup(restoreMustache(highlighted)))
+ return fillEmptyHighlightedLine(restoreMustache(highlighted))
}
}
diff --git a/src/node/plugin.ts b/src/node/plugin.ts
index eed1c009..c079dad6 100644
--- a/src/node/plugin.ts
+++ b/src/node/plugin.ts
@@ -95,22 +95,6 @@ export async function createVitePressPlugin(
}
}
- const getMergedAssetUrlOptions = () => {
- const { transformAssetUrls } = userVuePluginOptions?.template ?? {}
- const assetUrlOptions = { includeAbsolute: true }
-
- if (transformAssetUrls && typeof transformAssetUrls === 'object') {
- // presence of array fields means this is raw tags config
- if (Object.values(transformAssetUrls).some((val) => Array.isArray(val))) {
- return { ...assetUrlOptions, tags: transformAssetUrls as any }
- } else {
- return { ...assetUrlOptions, ...transformAssetUrls }
- }
- } else {
- return assetUrlOptions
- }
- }
-
// lazy require plugin-vue to respect NODE_ENV in @vue/compiler-x
const vuePlugin = await import('@vitejs/plugin-vue').then((r) =>
r.default({
@@ -121,8 +105,7 @@ export async function createVitePressPlugin(
compilerOptions: {
...userVuePluginOptions?.template?.compilerOptions,
isCustomElement
- },
- transformAssetUrls: getMergedAssetUrlOptions()
+ }
}
})
)
@@ -169,7 +152,8 @@ export async function createVitePressPlugin(
site.themeConfig?.search?.provider === 'algolia' ||
!!site.themeConfig?.algolia, // legacy
__CARBON__: !!site.themeConfig?.carbonAds,
- __ASSETS_DIR__: JSON.stringify(siteConfig.assetsDir)
+ __ASSETS_DIR__: JSON.stringify(siteConfig.assetsDir),
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: !!process.env.DEBUG
},
optimizeDeps: {
// force include vue to avoid duplicated copies when linked + optimized
diff --git a/src/node/plugins/dynamicRoutesPlugin.ts b/src/node/plugins/dynamicRoutesPlugin.ts
index 953a8325..0b4ed6a0 100644
--- a/src/node/plugins/dynamicRoutesPlugin.ts
+++ b/src/node/plugins/dynamicRoutesPlugin.ts
@@ -119,7 +119,7 @@ export const dynamicRoutesPlugin = async (
// inject raw content
// this is intended for integration with CMS
- // we use a speical injection syntax so the content is rendered as
+ // we use a special injection syntax so the content is rendered as
// static local content instead of included as runtime data.
if (content) {
baseContent = baseContent.replace(//, content)
diff --git a/src/node/siteConfig.ts b/src/node/siteConfig.ts
index 56c0592c..74174280 100644
--- a/src/node/siteConfig.ts
+++ b/src/node/siteConfig.ts
@@ -147,6 +147,15 @@ export interface UserConfig
*/
useWebFonts?: boolean
+ /**
+ * This option allows you to configure the concurrency of the build.
+ * A lower number will reduce the memory usage but will increase the build time.
+ *
+ * @experimental
+ * @default 64
+ */
+ buildConcurrency?: number
+
/**
* @experimental
*
@@ -240,4 +249,5 @@ export interface SiteConfig
}
logger: Logger
userConfig: UserConfig
+ buildConcurrency: number
}
diff --git a/src/shared/shared.ts b/src/shared/shared.ts
index c69f7277..9dd05e34 100644
--- a/src/shared/shared.ts
+++ b/src/shared/shared.ts
@@ -113,6 +113,10 @@ export function createTitle(siteData: SiteData, pageData: PageData): string {
const templateString = createTitleTemplate(siteData.title, template)
+ if (title === templateString.slice(3)) {
+ return title
+ }
+
return `${title}${templateString}`
}
diff --git a/tsconfig.json b/tsconfig.json
index b780a0df..a69d45e8 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,5 +12,12 @@
"jsx": "preserve",
"lib": ["esnext", "dom", "dom.iterable"]
},
- "exclude": ["**/node_modules/**", "**/dist/**", "template"]
+ "exclude": [
+ "**/node_modules/**",
+ "**/dist/**",
+ "template",
+ "bin",
+ "docs/snippets",
+ "scripts"
+ ]
}
diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts
index 94dfb95c..c89551b0 100644
--- a/types/default-theme.d.ts
+++ b/types/default-theme.d.ts
@@ -345,6 +345,7 @@ export namespace DefaultTheme {
desc?: string
links?: SocialLink[]
sponsor?: string
+ actionText?: string
}
// outline -------------------------------------------------------------------