@scalar/code-highlight 0.3.5 → 0.3.6
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.
- package/CHANGELOG.md +7 -0
- package/dist/chunks/languages.js +43 -1
- package/dist/chunks/languages.js.map +1 -1
- package/dist/chunks/markdown.js +2 -1
- package/dist/chunks/markdown.js.map +1 -1
- package/dist/chunks/rehype-highlight.js +2 -0
- package/dist/chunks/rehype-highlight.js.map +1 -1
- package/dist/css/code.css +0 -4
- package/dist/languages/basic.d.ts.map +1 -1
- package/dist/languages/python.d.ts +22 -0
- package/dist/languages/python.d.ts.map +1 -0
- package/dist/languages/standard.d.ts.map +1 -1
- package/dist/markdown/markdown.d.ts.map +1 -1
- package/dist/rehype-highlight/rehype-highlight.d.ts +2 -0
- package/dist/rehype-highlight/rehype-highlight.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2926,6 +2926,7 @@ function rehypeHighlight(options) {
|
|
|
2926
2926
|
const plainText = settings.plainText;
|
|
2927
2927
|
const prefix = settings.prefix;
|
|
2928
2928
|
const subset = settings.subset;
|
|
2929
|
+
const extraClassNames = typeof settings.className === "string" ? [settings.className] : settings.className ?? [];
|
|
2929
2930
|
let name = "hljs";
|
|
2930
2931
|
const lowlight = options?.lowlight ?? createLowlight(languages);
|
|
2931
2932
|
if (aliases) lowlight.registerAlias(aliases);
|
|
@@ -2941,6 +2942,7 @@ function rehypeHighlight(options) {
|
|
|
2941
2942
|
if (lang === "no-highlight" || !lang && !detect || lang && plainText?.includes(lang)) return;
|
|
2942
2943
|
if (!Array.isArray(node.properties.className)) node.properties.className = [];
|
|
2943
2944
|
if (!node.properties.className.includes(name)) node.properties.className.unshift(name);
|
|
2945
|
+
for (const extraClassName of extraClassNames) if (!node.properties.className.includes(extraClassName)) node.properties.className.push(extraClassName);
|
|
2944
2946
|
let result;
|
|
2945
2947
|
try {
|
|
2946
2948
|
result = lang ? lowlight.highlight(lang, toText(parent), { prefix }) : lowlight.highlightAuto(toText(parent), {
|