You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The my-command-that-produces-json-stdout is a command that produces json stdout. This example uses json, but it applies to any other output format.
When the code block stdout is rendered in Pandoc, I want it to be rendered with json syntax highlighting, i.e. as a json code block.
Somehow I would need to inform the codebraid bash code block that a stdout JSON code block should be rendered.
Maybe the rich_format option can be used, e.g. rich_format:json or some other option can be introduced. Ideally, all of the languages that appear in pandoc --list-highlight-languages should be supported.
Another option could be to add a new keyword that is understood by codebraid, e.g. cb-bash-runner, that codebraid will prefer if it exists. If codebraid sees this annotation in the code block header, then it will prefer this as the code runner, and then regular pandoc syntax can be used. The following example indicates that the body of the code block should be rendered as json (something that pandoc does), and that codebraid should execute the body using bash, and then replace the body with the stdout:
More customization for stdout formatting could be good. The current syntax could probably be extended to support something like show=stdout:verbatim:json or maybe even just show=stdout:json.
Do you anticipate any situations where a single code block will produce stdout in multiple formats? I've been working on new features that could make that possible.
I'm currently finishing the next version of Codebraid Preview, which will bring scroll sync for all Markdown variants, not just commonmark, commonmark_x, and gfm. Once that's done, I will be working on a new version of Codebraid and should be able to incorporate stdout format customization. In the meantime, you could probably try something like show=stdout:raw and then wrap your JSON output like this:
I have a code block that looks like this:
The
my-command-that-produces-json-stdout
is a command that produces json stdout. This example uses json, but it applies to any other output format.When the code block stdout is rendered in Pandoc, I want it to be rendered with json syntax highlighting, i.e. as a json code block.
Somehow I would need to inform the codebraid bash code block that a stdout JSON code block should be rendered.
Maybe the
rich_format
option can be used, e.g.rich_format:json
or some other option can be introduced. Ideally, all of the languages that appear inpandoc --list-highlight-languages
should be supported.Another option could be to add a new keyword that is understood by codebraid, e.g. cb-bash-runner, that codebraid will prefer if it exists. If codebraid sees this annotation in the code block header, then it will prefer this as the code runner, and then regular pandoc syntax can be used. The following example indicates that the body of the code block should be rendered as json (something that pandoc does), and that codebraid should execute the body using bash, and then replace the body with the stdout:
The text was updated successfully, but these errors were encountered: