0.2.4 • Published 5 months ago

cirru-color v0.2.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 months ago

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-color

Highlight 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-text

for 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

0.2.4

5 months ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1-a1

3 years ago

0.2.0

9 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago