@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.
@@ -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), {