0.2.4 • Published 2 years ago
cirru-color v0.2.4
Cirru Color
Syntax highlighting tool inspired by Pygements
Demo http://repo.cirru.org/cirru-color/
It's mainly based on my PR on pygments for adding Cirru highlighting.
Usage
npm install cirru-colorHighlight code:
import {generateHtml} from 'cirru-color'
html = generateHtml 'cirru code'Styles in /assets/cirru.css.
Or just parsing:
import {parse} from 'cirru-color'
tokens = parse 'cirru code'valid types here are:
whitespace
func
para
punc
dollar
string
string-text
escape
escape-textfor code:
print $ unwrap $it returns:
[
[
{
"type": "func",
"text": "print"
},
{
"type": "whitespace",
"text": " "
},
{
"type": "dollar",
"text": "$"
},
{
"type": "whitespace",
"text": " "
},
{
"type": "func",
"text": "unwrap"
},
{
"type": "whitespace",
"text": " "
},
{
"type": "dollar",
"text": "$"
}
]
]License
MIT