[pmwiki-users] custom sourceblock markup

Alexandre Leray alexandre at stdin.fr
Thu Feb 10 12:01:05 CST 2011


I've been using the sourceblock recipe to highlight my code snippets,
but I'm not satisfied with the html wrapping the source blocks. To me it
seems more correct to wrap it with `<pre><code>...</code></pre>`. Also
I'd like something more flexible in terms of style.

I have a good experience with highlight.js and would like to use it
instead of sourceblock. The problem is that I need to wrap my source
blocks with `<pre><code class="lang">...</code></pre>`.

I thought I could write my own custom markup but I'm stuck.

Here is what I have so far (without the class="lang" implemented yet):

Markup("highlight", "fulltext",

The problem is that pmwiki processes the inner content of the block and
I end up with things like this:

<ol><li>! /bin/bash
</li></ol><p>timestamp=`date "+<span class='d-'>m-</span><span
class='y_'>H-</span><span class='M-'>S"`</span>
import -screen $filename
</p><ol><li>in case we capture only a window, crop the image to the
right offset

</li></ol><p>size=`identify -format "%[fx:w]x%[fx:h]" $filename`
convert $filename -repage $size+0+0 $filename

Could you help me solving this out?



More information about the pmwiki-users mailing list