Skip to content

cedar-policy/prism-cedar

Prism support for Cedar policy language and Cedar human-readable schema

Prism (a lightweight, extensible syntax highlighter) support for Cedar policy language based on Grammar specification for Cedar policy syntax and for Cedar human-readable schema based on Grammar specification for human-readable schemas and mapped tp Prism tokens.

Use

Web browser <script src=> usage example from test/static/index.html (adjust the script src paths as required):

    <script src="prism.js"></script>
    <script src="prism-cedar.js"></script>

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 to create dist/prism-cedar.min.js with the --minify option.

Test

npm run test uses vitest to syntax highlight test/data/*.cedar and test/data/*.cedarschema files and compares against a generated .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 for more information.

License

This project is licensed under the Apache-2.0 License.