diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index d156505384..68756bd6c5 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -72,20 +72,6 @@ export default defineUserConfig({ extendsMarkdown: (md) => { md.use(footnote) - - // FIXME: Should be removed with next vuepress version - const rawFence = md.renderer.rules.fence! - const rawCodeInline = md.renderer.rules.code_inline! - - md.renderer.rules.fence = (...args) => { - const result = rawFence(...args) - return result.replace(' { - const result = rawCodeInline(...args) - return ` `
`) .join('') - const lineNumbersWrapperCode = `` + const lineNumbersWrapperCode = `` const finalCode = rawCode .replace(/<\/div>$/, `${lineNumbersWrapperCode}`) diff --git a/plugins/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap b/plugins/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap index add59dfff3..db1b8df587 100644 --- a/plugins/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap +++ b/plugins/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap @@ -5,7 +5,7 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
Raw text
 
-
Raw text
+
Raw text
 
const foo = 'foo'
 
@@ -19,7 +19,7 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -37,7 +37,7 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -49,9 +49,9 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
 exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers / :no-line-numbers > should work properly if \`lineNumbers\` is enabled by default 1`] = `
 "
Raw text
 
-
Raw text
+
Raw text
 
-
Raw text
+
Raw text
 
const foo = 'foo'
 
@@ -59,13 +59,13 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -77,13 +77,13 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -97,7 +97,7 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
 
Raw text
 
-
Raw text
+
Raw text
 
const foo = 'foo'
 
@@ -105,13 +105,13 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -123,13 +123,13 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -138,6 +138,48 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers /
 
" `; +exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers=number > should work properly if \`lineNumbers\` is disabled by default 1`] = ` +"
const line2 = 'line 2'
+const line3 = 'line 3'
+
+
const line3 = 'line 3'
+const line4 = 'line 4'
+const line5 = 'line 5'
+
+
const line10 = 'line 10'
+const line11 = 'line 11'
+
+
" +`; + +exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers=number > should work properly if \`lineNumbers\` is enabled by default 1`] = ` +"
const line2 = 'line 2'
+const line3 = 'line 3'
+
+
const line3 = 'line 3'
+const line4 = 'line 4'
+const line5 = 'line 5'
+
+
const line10 = 'line 10'
+const line11 = 'line 11'
+
+
" +`; + +exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers=number > should work properly if \`lineNumbers\` is set to a number by default 1`] = ` +"
const line2 = 'line 2'
+const line3 = 'line 3'
+
+
const line3 = 'line 3'
+const line4 = 'line 4'
+const line5 = 'line 5'
+
+
const line10 = 'line 10'
+const line11 = 'line 11'
+
+
" +`; + exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > highlight notation > should highlight notation 1`] = ` "
const foo = 'foo' 
 const bar = 'bar' 
@@ -146,25 +188,25 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > highlight notati
 const quux = 'quux' 
 const corge = 'corge' 
 
-
" +
" `; exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options > should disable \`highlightLines\` 1`] = ` "
Raw text
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -174,7 +216,7 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options >
   return 2048
 }
 
-

{{ inlineCode }}

+

{{ inlineCode }}

" `; @@ -245,13 +287,13 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options > return 1024 }
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -261,26 +303,26 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options >
   return 2048
 }
 
-

{{ inlineCode }}

+

{{ inlineCode }}

" `; exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options > should process code fences with default options 1`] = ` "
Raw text
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
 }
 
-
const foo = 'foo'
+
const foo = 'foo'
 
 function bar () {
   return 1024
@@ -290,56 +332,56 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options >
   return 2048
 }
 
-

{{ inlineCode }}

+

{{ inlineCode }}

" `; exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > syntax highlighting > should work if highlighted code is not wrapped with \`
\` 1`] = `
 "
highlighted code: Raw text
 , lang: 
-
highlighted code: const foo = 'foo'
+
highlighted code: const foo = 'foo'
 
 function bar () {
   return 1024
 }
 , lang: js
-
highlighted code: const foo: string = 'foo'
+
highlighted code: const foo: string = 'foo'
 
 function bar (): number {
   return 1024
 }
 , lang: ts
-
highlighted code: