I’m looking for a tool that takes code as input and outputs this code as syntax highlighted HTML+CSS.
It can either be a local tool (running natively on GNU/Linux) or a self-hosted web app (Linux server). In either case, it must be FLOSS.
Input
I only need support for "Web languages" (i.e., XML, HTML, CSS and JavaScript). But support for more languages is welcome, of course.
The tool doesn’t have to guess the language; I’m fine with selecting it.
Output
It should escape characters that might conflict with (X)HTML, e.g. <
as <
.
It should use only div
and span
elements to markup the code.
It should not use the style
attribute! Either use the style
element (so I can copy the CSS and paste it into my stylesheet) or offer a separate CSS file.
For that, it should use class
attributes (data-*
is okay, too). At best it uses semantic class values, and some kind of prefix to avoid name conflicts.
Just to give a poor example, here is an HTML input followed by an acceptable output:
<p>Lheben teil brann i annon ar <b id="foo">neledh</b> neledhi gar godrebh.</p>
<span class="sh-html-tag"><p></span>Lheben teil brann i annon ar <span class="sh-html-tag"><b <span class="sh-html-attribute">id="foo"</span>></span>neledh<span class="sh-html-tag"></b></span> neledhi gar godrebh.<span class="sh-html-tag"></p></span>