@vxrn/mdx 1.10.1 → 1.10.2

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/dist/index.js CHANGED
@@ -22642,7 +22642,11 @@ var rehypeHighlightCode = (options2 = {}) => {
22642
22642
  function visitor(node2, index3, parent) {
22643
22643
  if (!parent || parent.tagName !== "pre" || node2.tagName !== "code" || !node2.properties.className)
22644
22644
  return;
22645
- let [_2, lang] = node2.properties.className[0].split("-"), codeString = toString(node2), result = refractor.highlight(codeString, lang), linesToHighlight = (0, import_parse_numeric_range.default)(node2.properties.line || "0");
22645
+ let langClass = node2.properties.className[0];
22646
+ if (!langClass) return;
22647
+ let [_2, lang] = langClass.split("-");
22648
+ if (!lang || !refractor.registered(lang)) return;
22649
+ let codeString = toString(node2), result = refractor.highlight(codeString, lang), linesToHighlight = (0, import_parse_numeric_range.default)(node2.properties.line || "0");
22646
22650
  result = rehypeHighlightLine(result, linesToHighlight), node2.children = rehypeHighlightWord(result);
22647
22651
  }
22648
22652
  };