klor

syntax highlighting

  • klor

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
klor
2.17.02 years ago5 years agoMinified + gzip package size for klor in KB

Readme

klor
klor is a simple syntax highlighting tool. It exports the following function:

parse lines, ext

  • lines: array of strings
  • ext: file type
- coffee js ts 
- styl css sass
- pug html svg 
- bash fish sh 
- cpp hpp c h 
- noon json
- md plist 
returns an array of objects:
[
    ext:    string              
    chars:  number              
    index:  number              
    number: index+1 
    chunks: [
                match:  string  # without whitespace characters
                clss:   string  # value of match
                turd:   string  # following punctuation characters
                start:  number  # character index of match in line
                length: number  # length of match
            ]
...
]

See kolor.map for a list of recognized chunk values.

🌈 kolor

kolor is a submodule which exports a bunch of functions for wrapping strings in 256 color ansi codes.
It's a merge of colorette and ansi-256-colors
klor = require 'klor'
klor.kolor.globalize() # hoist color functions into the global scope
log y8 'bright yellow' + R1 'on dark red'

!npm packagenpm-imagenpm-url !Build Statustravis-imagetravis-url !downloadsdownloads-imagedownloads-url