-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stephan Renatus <[email protected]>
- Loading branch information
Showing
1 changed file
with
35 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,15 @@ the Rego syntax definition file (`rego.min.js` or `rego.es.min.js`). Include it | |
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Highlight.js Rego Demo</title> | ||
<link rel="stylesheet" href="path/to/theme.css"> | ||
<script type="text/javascript" src="path/to/highlight.min.js"></script> | ||
<script type="text/javascript" src="path/to/rego.min.js"></script> | ||
<script type="text/javascript">hljs.highlightAll();</script> | ||
</head> | ||
|
||
<body> | ||
<pre><code class="language-rego"> | ||
<head> | ||
<title>Highlight.js Rego Demo</title> | ||
<link rel="stylesheet" href="path/to/theme.css"> | ||
<script type="text/javascript" src="path/to/highlight.min.js"></script> | ||
<script type="text/javascript" src="path/to/rego.min.js"></script> | ||
<script type="text/javascript">hljs.highlightAll();</script> | ||
</head> | ||
<body> | ||
<pre><code class="language-rego"> | ||
# METADATA | ||
# description: Your Rego policy here! | ||
package policy | ||
|
@@ -33,10 +32,34 @@ default allow := false | |
allow if { | ||
# ..conditions.. | ||
} | ||
</code></pre> | ||
</body> | ||
</code></pre> | ||
</body> | ||
</html> | ||
``` | ||
|
||
or use the ES modules from a JS CDN: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Highlight.js Rego Demo</title> | ||
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/[email protected]/styles/default.min.css"> | ||
<script type="module"> | ||
import hljs from 'https://unpkg.com/@highlightjs/[email protected]/es/highlight.min.js'; | ||
import rego from 'https://unpkg.com/@styra/[email protected]/dist/rego.es.min.js'; | ||
hljs.registerLanguage('rego', rego); | ||
hljs.highlightAll(); | ||
</script> | ||
</head> | ||
<body> | ||
<pre><code class="language-rego"> | ||
package policy | ||
default allow := false | ||
</code></pre> | ||
</body> | ||
</html> | ||
|
||
``` | ||
|
||
## How to build | ||
|