https://github.com/TheFireBlast/irojs
A grammar generator for syntax highlighters.
https://github.com/TheFireBlast/irojs
compiler javascript syntax-highlighting
Last synced: about 2 months ago
JSON representation
A grammar generator for syntax highlighters.
- Host: GitHub
- URL: https://github.com/TheFireBlast/irojs
- Owner: TheFireBlast
- Created: 2021-12-31T02:55:08.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-15T06:00:43.000Z (almost 2 years ago)
- Last Synced: 2025-02-07T07:04:16.599Z (10 months ago)
- Topics: compiler, javascript, syntax-highlighting
- Language: TypeScript
- Homepage: https://fireblast.js.org/irojs-editor/
- Size: 157 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
IroJS
A grammar generator for syntax highlighters.
This project aims to be a superset of Chris Ainsley's [Iro](https://eeyo.io/iro/), a development tool designed to simplify the creation of syntax highlighters.
# Installation
```
npm install irojs
```
# Usage
## From the command line
Basic syntax:
```
iro compile --targets=
```
Available targets:
- `textmate` or `tm`
- `textmate.xml` *(default)*
- `textmate.json`
- `ace`
- `ace.js` *(default)*
- `ace.json`
- `ast` — outputs the rion ast
- `all` or `*` — matches all targets
- `none` — only checks grammar
Use `.*` to match all extensions.
Example:
```
iro compile mygrammar.iro --targets=textmate,ace -o out/
```
## From code
Example:
```js
import * as iro from "irojs";
// or
const iro = require("irojs");
const myGrammar = "...";
var result = iro.compile(myGrammar, { targets: ["textmate"] });
console.log(result.textmate);
```
# Language Documentation
The documentation is still a WIP. In the meanwhile, you can access the original docs at https://web.archive.org/web/20191007073218/https://eeyo.io/iro/documentation/index.html
# Development
`pnpm build` → builds the package.
`pnpm build:swc` → compiles the typescript source.
`pnpm build:rion` → compiles the rion grammar.
`pnpm build:type` → generates the type definition files.
## Roadmap
- Online editor
- VSCode extension (language server)
- Styles to CSS
- HighlightJS target
- PrismJS target
- CodeMirror target