import { visit } from 'unist-util-visit'; export default function rehypeCustomization() { return (tree: any) => { visit(tree, 'element', (node) => { // Change the footnotes heading text (hard-wired to "Footnotes") // by Astro or remark (not sure) if ( node.tagName === 'h2' && node.properties?.id === 'footnote-label' ) { node.children[0].value = 'Zdroje'; } // Embed SVG icons instead of using inline style supplying data url if ( node.tagName === 'span' && node.properties?.class?.includes("octicon") ) { let octicon_kind = node.properties.class.split(" ")[1] node.tagName = "img" node.properties.src = `/icons/${octicon_kind}.svg` node.properties.alt = octicon_kind node.properties.class = `custom-octicon` node.properties.style = "" } }); }; }