Cirru / cirru-color

Syntax highlighting for Cirru, inspired by Pygments

Home Page:https://repo.cirru.org/cirru-color/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Syntax highlighting for Cirru, inspired by Pygments

https://repo.cirru.org/cirru-color/


Languages

Language:CoffeeScript 76.8%Language:CSS 9.7%Language:JavaScript 8.3%Language:HTML 5.3%