From 8265721765383a04ad9266a4545e84dcfe30f708 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 10 Oct 2017 21:44:22 +0100 Subject: [PATCH] apply syntax highlighting to markdown formatted docs --- public_html/lib/plugins/markdownextra/markdown.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public_html/lib/plugins/markdownextra/markdown.php b/public_html/lib/plugins/markdownextra/markdown.php index 0edba0f3..cb1ed3aa 100755 --- a/public_html/lib/plugins/markdownextra/markdown.php +++ b/public_html/lib/plugins/markdownextra/markdown.php @@ -2968,14 +2968,17 @@ class MarkdownExtra_Parser extends Markdown_Parser { if ($classname != "") { if ($classname{0} == '.') $classname = substr($classname, 1); - $attr_str = ' class="'.$this->code_class_prefix.$classname.'"'; + $attr_str = ' class="code '.$this->code_class_prefix.$classname.'"'; } else { $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs); } $pre_attr_str = $this->code_attr_on_pre ? $attr_str : ''; $code_attr_str = $this->code_attr_on_pre ? '' : $attr_str; - $codeblock = "$codeblock"; - + + // apply syntax metadata to the code block + $syntaxcode = p_xhtml_cached_geshi($codeblock, $classname, null); + $codeblock = "$syntaxcode"; + return "\n\n".$this->hashBlock($codeblock)."\n\n"; } function _doFencedCodeBlocks_newlines($matches) {