← Back to team overview

zim-wiki team mailing list archive

Re: question about html template: pre tag


On Fri, Dec 3, 2010 at 1:11 PM, Ramiro Magno <ramiro.magno@xxxxxxxxx> wrote:
> just wondering, has any of you made a html template that redefines(?)
> the pre tag to something that would have syntax highlighting
> (http://alexgorbatchev.com/SyntaxHighlighter/)?
> I really dont know html so don't curse me if I'm asking something
> impossible. For me it would be really nice to get all the verbatim
> formatted text of my zim pages translated to some syntax highlighted
> text.

Current template engine does not allow you to redefine tags. So will
need some manual work or a post-processing script.

Looking at the javascript highlighter you linked you can do it as follows:
1/ add include for this javascript in the zim template
2/ for blocks that you want highlighted in the output add some tag to mark them
3/ write a small script that goes over the HTML and replaces the tag
by a special class attribute in the <pre> tag

To fully automate this from zim we need a plugin that does the HTML
post-processing on the fly. Anyone who would like to work on that ?

Please put the request also in the bug tracker for future reference.