🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

cirru-color

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cirru-color

cirru highlighting as HTML

latest
Source
npmnpm
Version
0.2.4
Version published
Maintainers
1
Created
Source

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

Keywords

cirru

FAQs

Package last updated on 06 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts