[pmwiki-users] custom sourceblock markup
Alexandre Leray
alexandre at stdin.fr
Thu Feb 10 12:01:05 CST 2011
Hi,
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",
"/\\(:highlight:\\)(.*?)\\(:highlightend:\\)/s",
"<pre><code>$1</code></pre>");
The problem is that pmwiki processes the inner content of the block and
I end up with things like this:
<pre><code>
<ol><li>! /bin/bash
</li></ol><p>timestamp=`date "+<span class='d-'>m-</span><span
class='y_'>H-</span><span class='M-'>S"`</span>
filename="/home/me/Desktop/screenshot_"$timestamp".png"
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
</p></code></pre>
Could you help me solving this out?
Best!
Alex
More information about the pmwiki-users
mailing list