gpoore / codebraid

Live code in Pandoc Markdown
BSD 3-Clause "New" or "Revised" License
376 stars 13 forks source link

Retain language-specific syntax highlighting in conversions #35

Closed aeturrell closed 4 years ago

aeturrell commented 4 years ago

Currently using

python{.python .cb.run show=code+stdout} var = 'Hello from Python!' print(var)

(ie syntax specific markdown) in a markdown file and executing it using codebraid with the '--to markdown' flag causes an error. Just using {.python .cb.run show=code+stdout} results in

{.python .numberLines startFrom="1"} var = 'Hello from Python!' print(var)

Would it be possible to implement a feature whereby language-specific syntax highlighting is preserved during execution?

gpoore commented 4 years ago

All of this is using Pandoc Markdown's attribute syntax, which wraps everything in braces {}. Are you wanting something like

```python

to work instead?

For syntax highlighting, I know that ```{.python ...} works in VS Code and I imagine it should be possible to customize other editors to do the same thing.

aeturrell commented 4 years ago

I see - it's most likely my local setup then. I did find that ```{.python ...} did not give syntax highlighting in export to other formats via the command line too (eg HTML). But this could be coming from (and perhaps changed in) pandoc. Will close this at it seems like it's outside of scope.