diff --git a/plugins/markdown/plugin-prismjs/src/node/markdown/preWrapperPlugin.ts b/plugins/markdown/plugin-prismjs/src/node/markdown/preWrapperPlugin.ts index cb6fb54e9..66491feff 100644 --- a/plugins/markdown/plugin-prismjs/src/node/markdown/preWrapperPlugin.ts +++ b/plugins/markdown/plugin-prismjs/src/node/markdown/preWrapperPlugin.ts @@ -28,8 +28,8 @@ export const preWrapperPlugin = ( const title = resolveAttr(info, 'title') ?? language.ext /** - * Add the `prismjs` class name to distinguish the highlight library used for the current code block. + * Add information to dataset for current code block. */ - return `
${result}
` + return `
${result}
` } } diff --git a/plugins/markdown/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap b/plugins/markdown/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap index 5401e43cf..fc526d367 100644 --- a/plugins/markdown/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap +++ b/plugins/markdown/plugin-prismjs/tests/__snapshots__/prismjs-preWrapper.spec.ts.snap @@ -1,43 +1,43 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > :line-numbers / :no-line-numbers > should work properly if \`lineNumbers\` is disabled by default 1`] = ` -"
Raw text
+"
Raw text
 
-
Raw text
+
Raw text
 
-
Raw text
+
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
 }
 
-
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
@@ -47,43 +47,43 @@ 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
+
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
 }
 
-
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
@@ -93,43 +93,43 @@ 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 set to a number by default 1`] = `
-"
Raw text
+"
Raw text
 
-
Raw text
+
Raw text
 
-
Raw text
+
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
 }
 
-
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
@@ -139,49 +139,49 @@ 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 line2 = 'line 2'
 const line3 = 'line 3'
 
-
const line3 = 'line 3'
+
const line3 = 'line 3'
 const line4 = 'line 4'
 const line5 = 'line 5'
 
-
const line10 = 'line 10'
+
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 line2 = 'line 2'
 const line3 = 'line 3'
 
-
const line3 = 'line 3'
+
const line3 = 'line 3'
 const line4 = 'line 4'
 const line5 = 'line 5'
 
-
const line10 = 'line 10'
+
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 line2 = 'line 2'
 const line3 = 'line 3'
 
-
const line3 = 'line 3'
+
const line3 = 'line 3'
 const line4 = 'line 4'
 const line5 = 'line 5'
 
-
const line10 = 'line 10'
+
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 foo = 'foo' 
 const bar = 'bar' 
 const baz = 'baz' 
 const qux = 'qux' 
@@ -192,21 +192,21 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > highlight notati
 `;
 
 exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options > should disable \`highlightLines\` 1`] = `
-"
Raw text
+"
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
@@ -221,21 +221,21 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options >
 `;
 
 exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options > should disable \`lineNumbers\` 1`] = `
-"
Raw text
+"
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
@@ -279,21 +279,21 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options >
 `;
 
 exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options > should enable \`lineNumbers\` according to number of code lines 1`] = `
-"
Raw text
+"
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
@@ -308,21 +308,21 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options >
 `;
 
 exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options > should process code fences with default options 1`] = `
-"
Raw text
+"
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
@@ -337,21 +337,21 @@ exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > plugin options >
 `;
 
 exports[`@vuepress/plugin-prismjs > markdown fence preWrapper > syntax highlighting > should work if highlighted code is not wrapped with \`
\` 1`] = `
-"
highlighted code: Raw text
+"
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: