export function sanitizeMultilineNodes()

in src/utils/syntax-highlight.js [198:217]


export function sanitizeMultilineNodes(element) {
  Array.from(element.childNodes).forEach((child) => {
    // if child element has multiple rows, go over them
    if (getLinesCount(child.textContent)) {
      try {
        // if there are multiple more nested children, go over them as well
        const elements = child.childNodes.length
          ? sanitizeMultilineNodes(child)
          // otherwise unwrap the lines.
          : duplicateMultilineNode(child);
        if (elements) {
          child.replaceWith(...elements);
        }
      } catch (err) {
        console.error(err);
      }
    }
  });
  return duplicateMultilineNode(element);
}