carrotsearch / gatsby-theme-apidocs

An opinionated Gatsby theme for writing technical documentation.
https://carrotsearch.github.io/apidocs/
2 stars 0 forks source link

Add support for embedding inputs with json comments, add support for trimming outer brackets and comment removal #11

Closed dweiss closed 1 year ago

dweiss commented 1 year ago

This adds support for embedding JSON with comments, optionally removing comments and trimming outer curly brackets. The syntax remains the same as with key selectors:

<pre data-embed="./examples/json.json" data-jsonpath="$..labelFilter{'key1', 'key2', trim-brackets, remove-comments}"></pre>

Note the 'options' (trim-brackets, remove-comments) which are not quoted. Quoted values are keys to select from labelFilter node.

This is a transparent change and allows for interesting possibilities like including partial values, including comments with highlights, etc.