Created
September 1, 2022 00:55
-
-
Save iksaku/ca31993899bd8e50b9787422b69ebfe9 to your computer and use it in GitHub Desktop.
Apply 'not-prose' class to pre tags rendered with Astro + Shiki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { visit } from 'unist-util-visit' | |
export default () => (tree, file) => { | |
visit(tree, 'element', (node) => { | |
if (! ('tagName' in node) || node.tagName !== 'pre') { | |
return; | |
} | |
node.properties.className.push('not-prose') | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment