// Docs code-block pipeline: js-beautify + shiki (github-dark theme). import beautify from 'js-beautify' import { createHighlighter, type Highlighter } from 'shiki' let highlighterPromise: Promise | undefined function getHighlighter(): Promise { highlighterPromise ??= createHighlighter({ themes: ['github-dark'], langs: ['html', 'yaml', 'js', 'ts', 'shell', 'diff', 'scss', 'css'], }) return highlighterPromise } export function beautifyHtml(code: string): string { // A comment that follows an element stays glued to it — js-beautify never adds // the break itself. Icon examples arrive as one line, so every "Download SVG // icon" comment would sit on the closing tag of the icon before it. const withCommentBreaks = code.replace(/>\s*