# archived-node-pygmentize-bundled **Repository Path**: mirrors_rvagg/archived-node-pygmentize-bundled ## Basic Information - **Project Name**: archived-node-pygmentize-bundled - **Description**: A simple wrapper around Python's Pygments code formatter, with Pygments bundled - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2026-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Pygmentize (Bundled) **Python's Pygments code formatter, for Node.js, distributed with Pygments** [](https://nodei.co/npm/pygmentize-bundled/) [](https://nodei.co/npm/pygmentize-bundled/) Can be used as either a *String-in, Buffer-out*, or as a Duplex stream. Compatible with both Python v2 and v3. **Note**: this library makes use of a child process which calls Python to invoke Pygments. This can cause performance problems where a large number of code blocks are being separately formatted. Consider using **[pygmentize-bundled-cached](https://github.com/rvagg/pygmentize-bundled-cached)**, an API-compatible wrapper for this library that keeps an on-disk cache of formatted code samples which will result in significantly faster formats when repeatedly formatting the same blocks of code. **Note 2**: this is a *Node.js-only* library and will *not* work in the browser, since Python is not available in the browser. For front-end highlighting, choose [a pure-JavaScript library](https://www.npmjs.com/search?q=syntax+highlighting). ## API **pygmentize(options, code, callback)** Pygmentize a given `code` string and return it as a Buffer to the `callback` Function. * `options` contains options to be passed to Pygments (see [Options](#options)). * `code` is a String to be formatted. * `callback` is a Function, called when complete. The first argument will be an `error` object/string if there was a problem and the second argument will be a Buffer containing your formatted code. **pygmentize(options)** When you only supply the `options` argument, it will return a Duplex stream that you can pipe to and from to format your code. * `options` contains options to be passed to Pygments (see [Options](#options)). ## Options Language/lexer, formatter, and their options are currently supported. Filters are not supported yet. * `lang`: source language/lexer name - `String` * `format`: output formatter name - `String` * `python`: the full path to the `python` command on the current system, defaults to `'python'` - `String` * `options`: lexer and formatter options, each key/value pair is passed through to `pygmentize` with `-P` - `Object` ## Examples The string interface is very simple: ```js var pygmentize = require('pygmentize-bundled') pygmentize({ lang: 'js', format: 'html' }, 'var a = "b";', function (err, result) { console.log(result.toString()) }) ``` Results in: ```html
var
a
=
"b"
;