stratus-color

a syntax highligher for standalone static use or by Stratus Editor

npm install stratus-color
4 downloads in the last month

Stratus:Color

Build Status

It works from the command line, or the browser, and is used by Stratus Editor.

Syntax languages are installed using stratus-bundle.

Install

Be sure you have stratus-bundle.

npm install -g stratus-color

CLI

Writes highlighted version of somefile.rb to ./somefile.rb.html, including the CSS for the theme.

$ stratus-color --file somefile.rb -s

Writes highlighted version of somefile.rb to ./somefile.rb.html, without the CSS for the theme.

$ stratus-color --file somefile.rb

API

color(text, rules, context)

Highlight a string

color = require 'stratus-color'

code = """def hello()
  puts "Hello, world"
end"""

color code, "Ruby"
# =>
# "<div>... the highlighted code ...</div>"

color code, "Ruby", format: "json"
# =>
# [ [... list of tokens for line 0 ...]
# , [... line 1 ...]
# , [...]
# ]

color.file(path, options?, callback)

Highlight a file

color.file "path/to/file.rb", (err, html) ->
  # ...

List of syntaxes

Writing syntaxes

License

See LICENSE.

npm loves you