gpoore / codebraid

Live code in Pandoc Markdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Syntax for Goldmark

henrysheehy opened this issue · comments

Dear developers,
Thank you for this brilliant work!
I would like to kindly ask how I might go about changing the current syntax:

```{.python .cb-nb}
# Some code
``` 

To a Goldmark syntax, for my own needs:

```python {.cb-nb}
# Some code
```

Kind regards,
Henry

The code block attribute syntax is from Pandoc. Codebraid uses Pandoc internally to do all the Markdown parsing, so changing syntax isn't possible within Codebraid itself. You could probably create a custom Pandoc Lua reader for Goldmark syntax, and then use that as the input format. You would have to identify all code blocks (and inline code, if you're using that), then rewrite the attributes into Pandoc syntax, and finally pass the result to Pandoc's Markdown parser. Or if you can figure out another way to convert a document from Goldmark syntax into Pandoc syntax, you could pipe your documents through the converter and into Codebraid.

Thank you, I appreciate your detailed reply!