gpoore / codebraid

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

Syntax for Goldmark #63

Open henrysheehy opened 6 months ago

henrysheehy commented 6 months ago

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:
# Some code

Kind regards,
Henry
gpoore commented 6 months ago

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.

henrysheehy commented 6 months ago

Thank you, I appreciate your detailed reply!