Skip to content

cedar-policy/prism-cedar

Prism support for Cedar policy language and Cedar schema

Prism (a lightweight, extensible syntax highlighter) support for Cedar policy language based on Grammar specification for Cedar policy syntax and for Cedar schema based on Grammar specification for Cedar schemas and mapped to 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 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.

Pull Request

Pull requests require a Developer Certificate of Origin (DCO) to certify the right to submit the code they are contributing to the project. Either add the -s or the --signoff flag to your commits or update your .vscode/settings.json with git.alwaysSignOff.

{
  "git.alwaysSignOff": true
}

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.