Socket
Socket
Sign inDemoInstall

pygments

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pygments

A pygments wrapper for nodejs


Version published
Weekly downloads
95
increased by58.33%
Maintainers
1
Install size
8.58 kB
Created
Weekly downloads
 

Readme

Source

Pygments

A pygments wrapper for node.js

Installation

Installing npm (node package manager)

  curl http://npmjs.org/install.sh | sh

Installing pygments

  [sudo] npm install pygments

Usage

colorize(target, lexer, format, callback, [options]);

  • Default lexer is js
  • Default format is html
Highlight code
var highlight = require('pygments').colorize;

highlight('puts "Hello World"', 'ruby', 'console', function(data) {
  console.log(data);
});
Highlight a file
var highlight = require('pygments').colorize;

highlight('/home/pkumar/package.json', null, 'html', function(data) {
  console.log(data);
});

If you want to highlight string /home/pkumar/package.json itself,

var highlight = require('pygments').colorize;

highlight('/home/pkumar/package.json', null, 'html', function(data) {
  console.log(data);
}, {'force': true});

Run Tests

All of the pygments tests are written in vows, and cover all of the use cases described above.

  npm test

License

See LICENSE for details.

Contact

Pavan Kumar Sunkara

pavan [dot] sss1991 [at] gmail [dot] com

Keywords

FAQs

Last updated on 26 Jul 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc