4 ms·
> THE PROBLEMS A GENERATOR SOLVES One problem not listed is source code syntax highlighting. If you provide source code listings in articles, then highlighting
by Octokiddie 4y ago
> THE PROBLEMS A GENERATOR SOLVES
One problem not listed is source code syntax highlighting. If you provide source code listings in articles, then highlighting is a big help to readers. Generating it in HTML is not fun.
- zelphirkalt 4y agoPygments does this easily, depending on the source for generating HTML pages. It has been available for a long time. For more than a decade. Some blog generators use it, not only Python blog generators.
- cxr 4y agoAlternatively, you could specify the type of the source code so the user agent could handle the syntax highlighting—just like every other source code viewer ever written aside from those with idiosyncrasies related to the fact that they that belong to a special class called "Web browsers".
- slmjkdbtl 4y agoTbh <pre> + monospace font + padding already makes a lot of code snippets readable, you can also write a 10 line js function to generate highlight for only the comments (to make them lesser shade of gray), i think that solves a lot of readability with very minimal work. Also I think there's no shame in using highlight.js