@md-plugins/md-plugin-codeblocks 0.1.0-beta.28 → 0.1.0-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +2 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -328,6 +328,7 @@ const codeblocksPlugin = (md, options) => {
328
328
  content = content.trim().replace(magicCommentGlobalRE, "");
329
329
  }
330
330
  const langProp = customCopyLangList.includes(lang) === true ? ` lang="${lang}"` : "";
331
+ const codeProp = ` code="${md.utils.escapeHtml(content)}"`;
331
332
  return highlighter.codeToHtml(content, {
332
333
  lang: normalizeShikiLang(lang),
333
334
  ...themeOptions,
@@ -338,7 +339,7 @@ const codeblocksPlugin = (md, options) => {
338
339
  preClass: preClass ?? "markdown-code",
339
340
  twoslash: twoslash === true || twoslash === "true"
340
341
  })
341
- }).replace("<pre ", "<pre v-pre ") + `<${copyButtonComponent}${langProp} />`;
342
+ }).replace("<pre ", "<pre v-pre ") + `<${copyButtonComponent}${langProp}${codeProp} />`;
342
343
  }
343
344
  function parseAttrs(rawAttrs) {
344
345
  if (rawAttrs === null) return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/md-plugin-codeblocks",
3
- "version": "0.1.0-beta.28",
3
+ "version": "0.1.0-beta.29",
4
4
  "description": "A markdown-it plugin for code blocks.",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -43,7 +43,7 @@
43
43
  "devDependencies": {
44
44
  "@types/markdown-it": "^14.1.2",
45
45
  "markdown-it": "^14.2.0",
46
- "@md-plugins/shared": "0.1.0-beta.28"
46
+ "@md-plugins/shared": "0.1.0-beta.29"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "markdown-it": "^14.2.0"