2017 © Pedro Peláez
 

library pygments

A Thin Wrapper for the Python Pygments

image

kzykhys/pygments

A Thin Wrapper for the Python Pygments

  • Thursday, December 19, 2013
  • by kzykhys
  • Repository
  • 2 Watchers
  • 12 Stars
  • 2,838 Installations
  • PHP
  • 4 Dependents
  • 4 Suggesters
  • 10 Forks
  • 7 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

Pygments.php - A Thin Wrapper for the Python Pygments

Latest Stable Version Build Status Coverage Status SensioLabsInsight, (*1)

A PHP wrapper for the Python Pygments syntax highlighter, (*2)

Requirements

  • PHP5.3+
  • Python 2.4+
  • Pygments (sudo easy_install Pygments)

Installation

Create or update your composer.json and run composer update, (*3)

``` json { "require": { "kzykhys/pygments": ">=1.0" } }, (*4)


Usage ----- ### Highlight the source code ``` php <?php use KzykHys\Pygments\Pygments; $pygments = new Pygments(); $html = $pygments->highlight(file_get_contents('index.php'), 'php', 'html'); $text = $pygments->highlight('package main', 'go', 'ansi');

Generate a CSS

``` php <?php, (*5)

use KzykHys\Pygments\Pygments;, (*6)

$pygments = new Pygments(); $css = $pygments->getCss('monokai'); $prefixedCss = $pygments->getCss('default', '.syntax');, (*7)


### Guesses a lexer name ``` php <?php use KzykHys\Pygments\Pygments; $pygments = new Pygments(); $pygments->guessLexer('foo.rb'); // ruby

Get a list of lexers/formatters/styles

``` php <?php, (*8)

use KzykHys\Pygments\Pygments;, (*9)

$pygments = new Pygments(); $pygments->getLexers() $pygments->getFormatters(); $pygments->getStyles();, (*10)


### Custom `pygmentize` path ``` php <?php use KzykHys\Pygments\Pygments; $pygments = new Pygments('/path/to/pygmentize');

License

The MIT License, (*11)

Author

Kazuyuki Hayashi (@kzykhys), (*12)

The Versions

19/12 2013

dev-master

9999999-dev

A Thin Wrapper for the Python Pygments

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kazuyuki Hayashi

pygments syntax highlight

18/12 2013

v1.0.0

1.0.0.0

A Thin Wrapper for the Python Pygments

  Sources   Download

The Requires

 

The Development Requires