Skip to content

Instantly share code, notes, and snippets.

@iksaku
Created September 1, 2022 00:55
Show Gist options
  • Save iksaku/ca31993899bd8e50b9787422b69ebfe9 to your computer and use it in GitHub Desktop.
Save iksaku/ca31993899bd8e50b9787422b69ebfe9 to your computer and use it in GitHub Desktop.
Apply 'not-prose' class to pre tags rendered with Astro + Shiki
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