All Projects → dedalozzo → pygmentize

dedalozzo / pygmentize

Licence: Apache-2.0 License
Pygmentize is a wrapper to `pygmentize`, the command line interface provided by Pygments, a python syntax highlighter.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to pygmentize

cablecuttr
An R wrapper for CanIStream.It API
Stars: ✭ 17 (-32%)
Mutual labels:  wrapper
hibpwned
Python API wrapper for haveibeenpwned.com (API v3)
Stars: ✭ 21 (-16%)
Mutual labels:  wrapper
pwnscripts
Very simple script(s) to hasten binary exploit creation
Stars: ✭ 66 (+164%)
Mutual labels:  wrapper
snow-ctp
Node CTP Wrapper
Stars: ✭ 15 (-40%)
Mutual labels:  wrapper
code-highlighter
Code syntax highlighter plugin for miro.com
Stars: ✭ 25 (+0%)
Mutual labels:  syntax-highlighter
vscode-fortran-support
Fortran language support for Visual Studio Code
Stars: ✭ 49 (+96%)
Mutual labels:  syntax-highlighter
GodotDiscordSDK
A Discord Game SDK wrapper for Godot, written in C.
Stars: ✭ 40 (+60%)
Mutual labels:  wrapper
gof
Yet another simple Go filesystem wrapper
Stars: ✭ 13 (-48%)
Mutual labels:  wrapper
QSourceHighlite
Lightweight syntax highlighter written in Qt
Stars: ✭ 39 (+56%)
Mutual labels:  syntax-highlighter
caller-lookup
Reverse Caller Id using TrueCaller
Stars: ✭ 55 (+120%)
Mutual labels:  wrapper
python-makefun
Dynamically create python functions with a proper signature.
Stars: ✭ 62 (+148%)
Mutual labels:  wrapper
steampak
Nicely packed tools to work with Steam APIs
Stars: ✭ 21 (-16%)
Mutual labels:  wrapper
Lavalink.py
A wrapper for Lavalink in Python, which aims to be powerful and intuitive.
Stars: ✭ 162 (+548%)
Mutual labels:  wrapper
hcloud-js
A Node.js module for the Hetzner Cloud API
Stars: ✭ 40 (+60%)
Mutual labels:  wrapper
pyGroff
laTEX is awesome but we are lazy -> groff with markdown syntax and inline code execution
Stars: ✭ 25 (+0%)
Mutual labels:  wrapper
Shift
Light-weight EventKit wrapper.
Stars: ✭ 31 (+24%)
Mutual labels:  wrapper
koishi
Python wrapper for the unofficial scraped API of the satori testing system.
Stars: ✭ 13 (-48%)
Mutual labels:  wrapper
popyt
A very easy to use Youtube Data v3 API wrapper.
Stars: ✭ 42 (+68%)
Mutual labels:  wrapper
hlsjs-upimg-wrapper
The upimg decoder module for hls.js
Stars: ✭ 19 (-24%)
Mutual labels:  wrapper
ZetaHtmlEditControl
A small wrapper class around the Windows Forms 2.0 WebBrowser control.
Stars: ✭ 72 (+188%)
Mutual labels:  wrapper

Latest Stable Version Latest Unstable Version Build Status Scrutinizer Code Quality License Total Downloads

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.

Composer Installation

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

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

You can run this command to easily access composer from anywhere on your system:

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

Pygmentize Installation

Once you have installed Composer, it's easy install Pygmentize.

  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:

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.

Parameters

  • source

    The source code.

  • language

    The programming language name of the source code.

  • encoding

    The file input and output encodings.

  • formatter

    The output will be created using the provided formatter.

  • style

    The style used by the formatter.

Returns

Returns the highlighted source code.

Exceptions

  • RuntimeException

    Cannot execute the pygmentize command.

  • RuntimeException

    Cannot create the temporary file with the source code.

Documentation

The documentation can be generated using Doxygen. A Doxyfile is provided for your convenience.

Requirements

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

Authors

Filippo F. Fadda - [email protected] - http://www.linkedin.com/in/filippofadda

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].