Code Snippets
2024-07-05
It can be tricky to display code in a way that doesn’t clash with the existing design.
Thankfully, there are highlighters like Prism. In fact, Missing Style comes with a readymade stylesheet just for it.
Although Astro uses another highlighter, Shiki, out of the box, we can set it up so that Markdown files’ code blocks use the <Prism /> component.
Now, we just have a small issue…
println!("Code figures aren't consistent!");
The next trick was to use .mdx which let me inline the necessary <figure> element into my document.