limi.eu

PHP Markdown Extra Extended for use with Syntax Highlighting Class for PHP

PHP Markdown Extra Extended for use with Syntax Highlighting Class for PHP

This slightly extended PHP Markdown Extra version is for use with Michel Fortin's PHP Markdown Extra class and my Syntax Highlighting Class for PHP. It is developed with PHP Markdown v. 1.5.0, so further versions might break this version.

This extended PHP Markdown Extra version together with my Syntax Highlighting Class for PHP is used to highlight syntax on this website.

Installation:

Usage:

Include the CSS file provided by the Syntax Highlighting Class in your HTML header and do something like this:

require_once $install_dir."/MarkdownExtraExtended.inc.php";

$my_html = MarkdownExtraExtended::defaultTransform($my_text);

or if you can use class autoloading

use "\Michelf\MarkdownExtraExtended";

$my_html = MarkdownExtraExtended::defaultTransform($my_text);

You may specify the language to highlight by applying one or more classnames to a code block like this:

```css
h1 {
    font-size: 25pt;
}
```

becomes

h1 {
    font-size: 25pt;
}

or

```{.html .php}
<body>
  <?php
     echo $content;
  ?>
</body>
```

becomes

<body>
  <?php
     echo $content;
  ?>
</body>

Please note:

If you don't want syntax highlightning in a code block at all you HAVE TO apply the class "nohighlight" to this code block.