Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cedar-policy/prism-cedar
Prism support for Cedar policy language
https://github.com/cedar-policy/prism-cedar
Last synced: about 2 months ago
JSON representation
Prism support for Cedar policy language
- Host: GitHub
- URL: https://github.com/cedar-policy/prism-cedar
- Owner: cedar-policy
- License: apache-2.0
- Created: 2023-09-07T00:37:09.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-22T03:02:43.000Z (3 months ago)
- Last Synced: 2024-04-23T06:02:12.276Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 182 KB
- Stars: 0
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Lists
- cedar-awesome - Prism syntax
README
# Prism support for Cedar policy language and Cedar human-readable schema
[Prism](https://prismjs.com/index.html) (a lightweight, extensible syntax highlighter) support for Cedar policy language based on [Grammar specification for Cedar policy syntax](https://docs.cedarpolicy.com/syntax-grammar.html) and for Cedar human-readable schema based on [Grammar specification for human-readable schemas](https://docs.cedarpolicy.com/schema/human-readable-schema-grammar.html) and mapped tp [Prism tokens](https://prismjs.com/tokens.html).
## Use
Web browser `` usage example from `test/static/index.html` (adjust the script `src` paths as required):
```html
<script src="prism.js">
```## Development
### Install
Install the project dependencies using `npm install`.
`src/prism-cedar.js` is the main source file.
### Build
The `npm run build` script uses [esbuild](https://esbuild.github.io/api/) to create `dist/prism-cedar.min.js` with the `--minify` option.
### Test
`npm run test` uses [vitest](https://vitest.dev) to syntax highlight `test/data/*.cedar` and `test/data/*.cedarschema` files and compares against a generated `.html`
[File Snapshots](https://vitest.dev/guide/snapshot.html#file-snapshots) for each Cedar and Cedar human-readable schema file.View the static `test/static/index.html` in your browser which loads `dist/prism-cedar.min.js`. The `test/static` folder includes a downloaded copy of PrismJS 1.29.0.
When new `test/data/*.cedar` or `test/data/*.cedarschema` files are created, `npm run testdata` will update the contents of each `index.html` file.
## Security
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
## License
This project is licensed under the Apache-2.0 License.