Syntax Highlighting, Example Hello World policy #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #65
some things to note with the addition of syntax highlighting...
The highlighter sometimes takes a moment to show the colors (viewing the occurrence JSON ,for example). I have added this to an issue to address later since it's not really breaking any functionality, it's just a weird experience.
With the change in to highlight code, the policy playground now shows the entire rego policy code, which is not a good experience if you have a lengthy policy. I plan on addressing this issue in my next PR.
The
prism.js
file included this PR is the code to do syntax highlighting. There is an npm package for Prism, but the latest release does not include the ability to parse rego. Once a new release of Prism and the babel plugin are cut, we can switch over to pulling down those dependencies instead of including them directly. The file is small and the parsing shouldn't change so not a huge deal, in my opinion. I have ignored the Prism file for linting and coverage.