kelunik/highlight

PHP Syntax Highlighter

v0.1.0 2016-11-11 12:51 UTC

This package is auto-updated.

Last update: 2024-10-15 07:41:00 UTC


README

A (PHP) syntax highlighter written in PHP.

<?php

$hl = new Kelunik\Highlight\Highlighter(new HtmlFormatter("php"));

// <optional>
$hl->addPreProcessor(new Your\Custom\PreProcessor);
$hl->addPostProcessor(new Your\Custom\PostProcessor);
// </optional>

print $hl->highlight("<?php print 'Hello World';");

CLI

These CLI scripts should give you some hints on how to use the API.

bin/highlight /path/to/file.php
bin/highlight-html /path/to/file.php > out.html

Supported Languages

Currently, only PHP is supported. But you could just add another Lexer.