Open benw01 opened 9 years ago
Thanks for this! In order to get it working I also had to comment out the htmlspecialchars, i.e.
// $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
And in order to avoid PHP Warning: array_keys() expects parameter 1 to be array
I used
require_once(DOKU_INC.'inc/parserutils.php');
$codeblock = p_xhtml_cached_geshi($codeblock, $classname ? $classname : 'text' );
Thanks for this as well! I tried the code by @xrat and it works for me as well.
In response to a question on https://www.dokuwiki.org/plugin:markdownextra, I had a crack at integrating GeSHi syntax highlighting.
Inside
function _doFencedCodeBlocks_callback($matches)
inmarkdown.php
, I've removedand replaced it with:
The three ways I evaluated were:
The version that uses
p_xhtml_cached_geshi()
gives the best looking results, but it doesn't support extra classes after the "~ $lang" declaration (e.g. ~{.html #example-1}, from https://michelf.ca/projects/php-markdown/extra/#fenced-code-blocks). So it's not perfect (and I guess isn't Markdown Extra compatible), but it looks good.