My colleague Seb wrote a cool package that adds tags and classes to code blocks in html, so they can be highlighted with css.

I created a spatie/commonmark-highlighter package that supports higlighting with CommonMark. After you register two custom renderers, all code blocks will receive a set of tags and classes, so they're already prepped to be highlighted by CSS when your content arrives in the browser.

https://sebastiandedeyne.com/highlighting-code-blocks-with-leaguecommonmark