CMarkdownParser and code highlighting

There are comment lines about it in utils\CMarkdonwParser.php

Quote

* CMarkdownParser extends MarkdownExtra_Parser by using Text_Highlighter
  • to highlight code blocks with specific language syntax.

  • In particular, if a code block starts with the following:

  • <pre>

  • [language]

  • </pre>

  • The syntax for the specified language will be used to highlight

  • code block. The languages supported include (case-insensitive):

  • ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT,

  • MYSQL, PERL, PHP, PYTHON, RUBY, SQL, XML

  • You can also specify options to be passed to the syntax highlighter. For example:

  • <pre>

  • [php showLineNumbers=1]

  • </pre>

  • which will show line numbers in each line of the code block.

I use CMarkDownParser in this way:

Quote

$parser=new CMarkdownParser;

$this->contentDisplay=$parser->safeTransform($this->content);

But I cant make it highlight any code in any language.

Is it a feature that hasnt realized yet?

This should work, what is the text that you've tried to parse?

Quote

<pre>

[php]

<?php

phpinfo();

?>

</pre>

It should be



[php]


php code here


After Chighlighting proccesing C++ code look as plain-text

that is why highlighting.css not contain classes for C++ (like cpp-hl-reserved and more)

please fix it

Thanks!

You can easily define these yourself.