Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Starmind/Pygments

Repository files navigation

Pygments PHP Library

The Pygments PHP library provides a way to work with the pygmentize CLI from http://pygments.org.

Currently only the HTML Formatter is supported with a limited subset of parameters.

Usage

$pygmentize = new Starmind\Pygmentize();  
$formatter = new Starmind\Formatter\Html();  
$pygments = new Starmind\Pygments($pygmentize);

// highlight the specified string
echo $pygments->highlight('<?php echo "test"; ?>', 'php', $formatter);

// by passing null for the second parameter, pygments will guess which lexer to use
echo $pygments->highlight('<?php echo "test"; ?>', null, $formatter);

// generate the css rules
echo $formatter->generateStyles($pygmentize);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages