Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cirru/cirru-color
Syntax highlighting for Cirru, inspired by Pygments
https://github.com/cirru/cirru-color
cirru syntax-highlighting
Last synced: about 1 month ago
JSON representation
Syntax highlighting for Cirru, inspired by Pygments
- Host: GitHub
- URL: https://github.com/cirru/cirru-color
- Owner: Cirru
- Created: 2014-01-15T11:40:50.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2023-12-13T08:57:37.000Z (about 1 year ago)
- Last Synced: 2024-04-15T10:02:50.627Z (9 months ago)
- Topics: cirru, syntax-highlighting
- Language: CoffeeScript
- Homepage: https://repo.cirru.org/cirru-color/
- Size: 39.1 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Cirru Color
------Syntax highlighting tool inspired by Pygements
Demo http://repo.cirru.org/cirru-color/
It's mainly based on my [PR on pygments][pr] for adding Cirru highlighting.
[pr]: https://github.com/pygments/pygments/blob/master/pygments/lexers/webmisc.py#L866
### Usage
```bash
npm install cirru-color
```Highlight code:
```coffee
import {generateHtml} from 'cirru-color'
html = generateHtml 'cirru code'
```Styles in `/assets/cirru.css`.
Or just parsing:
```coffee
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:
```cirru
print $ unwrap $
```it returns:
```json
[
[
{
"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