Closed zachahn closed 7 months ago
Hello! That sounds interesting. I certainly wouldn’t be opposed to it. I’ll take a look at what’s possible.
Without necessary knowing how syntect
works, how would you expect to use this? You pass in a string of classes, and have that applied to the container pre
?
Yup, something like that. I'm on my phone so I'm a little limited with what I can look up!
I currently use a CommonMarker
's custom renderer to process code blocks with Rouge, and I use a custom container to namespace my code styles. It also provides a way to generate CSS with various themes.
https://github.com/rouge-ruby/rouge
I found an example for syntect
. At a glance, it doesn't look like it supports a generating CSS with custom container class.
https://github.com/trishume/syntect/blob/master/examples/synhtml-css-classes.rs
Good news bad news.
Good news is I was able to easily slot this into the underlying Rust library: https://github.com/kivikakk/comrak/pull/347
Bad news is we'll have to wait for that to be accepted and merged before Commonmarker can make use of it. Sorry!
Thank you for looking into this so quickly!
@gjtorikian Thanks for that :3 Comrak 0.20.0 has been released with that PR merged!
Hello!
Do you have any plans to support syntax highlighting using CSS classes rather than inline styles? I've only done some light searching, but it looks like the
syntect
crate has something calledClassedHTMLGenerator
that generates output along the lines of<span class="...">
.This feature would let me use different themes based on dark/light mode. Totally understand if this won't be supported—I'm sure I can figure out a workaround.