[pmwiki-users] custom sourceblock markup

Peter Bowers pbowers at pobox.com
Thu Feb 10 12:22:12 CST 2011


On Thu, Feb 10, 2011 at 7:01 PM, Alexandre Leray <alexandre at stdin.fr> wrote:
> 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

Keep() is the key you're looking for -- it's an ingenious method for
preventing any other markup rules from operating over the text that
has been "kept".  Try something like this:

> Markup("highlight", "fulltext",
> "/\\(:highlight:\s*(.*?)\\)(.*?)\\(:highlightend:\\)/s",
> keep("<pre><code class=\"$1\">$2</code></pre>"));

You might look at these pages for more help:

* http://www.pmwiki.org/wiki/PmWiki/CustomMarkupAlt
* http://www.pmwiki.org/wiki/PmWiki/CustomMarkup

-Peter



More information about the pmwiki-users mailing list