Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/styrainc/highlightjs-rego
Syntax highlighting for Rego
https://github.com/styrainc/highlightjs-rego
highlightjs opa open-policy-agent policy-as-code rego syntax-highlighting
Last synced: 4 days ago
JSON representation
Syntax highlighting for Rego
- Host: GitHub
- URL: https://github.com/styrainc/highlightjs-rego
- Owner: StyraInc
- License: apache-2.0
- Created: 2024-11-21T08:15:30.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-22T12:40:25.000Z (about 1 month ago)
- Last Synced: 2024-12-24T00:13:24.883Z (12 days ago)
- Topics: highlightjs, opa, open-policy-agent, policy-as-code, rego, syntax-highlighting
- Language: JavaScript
- Homepage:
- Size: 134 KB
- Stars: 6
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# highlightjs-rego
[highlight.js](https://highlightjs.org/) syntax highlighting for the
[Rego](https://www.openpolicyagent.org/docs/latest/policy-language) language of Open Policy Agent (OPA).![Screenshot](assets/highlight-rego.png)
## How to use
Head over to the [releases](https://github.com/StyraInc/highlightjs-rego/releases) page and grab the minified version of
the Rego syntax definition file (`rego.min.js` or `rego.es.min.js`). Include it in your HTML file, and use the
`language-rego` class for the `` block you want to highlight:
```html
Highlight.js Rego Demo
hljs.highlightAll();
# METADATA
# description: Your Rego policy here!
package policydefault allow := false
allow if {
# ..conditions..
}
```
## How to build
Building from source can either be done by running the `build.sh` script in this repository, or manually
following the steps below.1. Clone the highlight.js repository
```
git clone https://github.com/highlightjs/highlight.js.git
```
2. Clone this repository
```
git clone https://github.com/StyraInc/highlightjs-rego.git
```
3. In the `extra` directory of the highlight.js repository, create a symlink to this repository
```shell
ln -s /path/to/highlightjs-rego /path/to/highlight.js/extra/highlightjs-rego
```
4. In the root of the highlight.js repository, run:
```shell
node ./tools/build.js -t cdn
```
5. You'll now find `rego.min.js` in the `build` directoryMore detailed instructions for building 3rd party language support for highlight.js can be found
[here](https://github.com/highlightjs/highlight.js/blob/main/extra/3RD_PARTY_QUICK_START.md#packaging).## Community
For questions, discussions and announcements related to Styra products, services and open source projects, please join
the Styra community on [Slack](https://communityinviter.com/apps/styracommunity/signup)!