2017 © Pedro Peláez
 

library pygmentize

Pygmentize is a wrapper to `pygmentize`, the command line interface provided by Pygments, a python syntax highlighter.

image

3f/pygmentize

Pygmentize is a wrapper to `pygmentize`, the command line interface provided by Pygments, a python syntax highlighter.

  • Wednesday, November 29, 2017
  • by dedalozzo
  • Repository
  • 1 Watchers
  • 6 Stars
  • 100 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

Latest Stable Version Latest Unstable Version Build Status Scrutinizer Code Quality License Total Downloads, (*1)

Pygmentize

Pygmentize is a wrapper to pygmentize, the command line interface provided by Pygments, a Python syntax highlighter. Pygmentize is smart enough to raise an exception in case Pygments returns an error., (*2)

Composer Installation

To install Pygmentize, you first need to install Composer, a Package Manager for PHP, following those few steps:, (*3)

curl -s https://getcomposer.org/installer | php

You can run this command to easily access composer from anywhere on your system:, (*4)

sudo mv composer.phar /usr/local/bin/composer

Pygmentize Installation

Once you have installed Composer, it's easy install Pygmentize., (*5)

  1. Edit your composer.json file, adding Pygmentize to the require section:
{
    "require": {
        "3f/pygmentize": "dev-master"
    },
}
  1. Run the following command in your project root dir:
composer update

Usage

Pygmentize is really easy to use, having only one static method. You just call highlight() like follows:, (*6)

Pygmentize::highlight($code, $language);

Methods

Pygmentize::highlight()

public static function highlight(
    $source,
    $language,
    $encoding = "utf-8",
    $formatter = "html",
    $style = "borland"
)

Formats the provided source code using the specified formatter and style., (*7)

Parameters, (*8)

  • source, (*9)

    The source code., (*10)

  • language, (*11)

    The programming language name of the source code., (*12)

  • encoding, (*13)

    The file input and output encodings., (*14)

  • formatter, (*15)

    The output will be created using the provided formatter., (*16)

  • style, (*17)

    The style used by the formatter., (*18)

Returns, (*19)

Returns the highlighted source code., (*20)

Exceptions, (*21)

  • RuntimeException, (*22)

    Cannot execute the pygmentize command., (*23)

  • RuntimeException, (*24)

    Cannot create the temporary file with the source code., (*25)

Documentation

The documentation can be generated using Doxygen. A Doxyfile is provided for your convenience., (*26)

Requirements

  • PHP 5.4.0 or above.
  • Pygments 1.6 or above.

Authors

Filippo F. Fadda - filippo.fadda@programmazione.it - http://www.linkedin.com/in/filippofadda, (*27)

License

Pygmentize is licensed under the Apache License, Version 2.0 - see the LICENSE file for details., (*28)

The Versions

29/11 2017

dev-master

9999999-dev https://github.com/dedalozzo/pygmentize

Pygmentize is a wrapper to `pygmentize`, the command line interface provided by Pygments, a python syntax highlighter.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

pygments pygmentize syntax highlighter

13/11 2017

1.3

1.3.0.0 https://github.com/dedalozzo/pygmentize

Pygmentize is a wrapper to `pygmentize`, the command line interface provided by Pygments, a python syntax highlighter.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

pygments pygmentize syntax highlighter

15/05 2017

1.2

1.2.0.0 http://github.com/dedalozzo/Pygmentize

Pygmentize is a wrapper to 'pygmentize', the command line interface provided by Pygments, a python syntax highlighter.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

pygments pygmentize syntax highlighter

24/04 2015

1.1

1.1.0.0 http://github.com/dedalozzo/Pygmentize

Pygmentize is a wrapper to 'pygmentize', the command line interface provided by Pygments, a python syntax highlighter.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

pygments pygmentize syntax highlighter

25/02 2015

1.0

1.0.0.0 http://github.com/dedalozzo/Pygmentize

Pygmentize is a wrapper to 'pygmentize', the command line interface provided by Pygments, a python syntax highlighter.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

pygments pygmentize syntax highlighter