Skip to content

Feature request: override stdout code block language #61

@W1M0R

Description

@W1M0R

I have a code block that looks like this:

{.bash .cb-run show=stdout:verbatim}
my-command-that-produces-json-stdout
EOF

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:

{.json .cb-bash-runner .cb-run show=stdout:verbatim}
my-command-that-produces-json-stdout
EOF

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions