codebraid icon indicating copy to clipboard operation
codebraid copied to clipboard

Syntax for Goldmark

Open henrysheehy opened this issue 5 months ago • 2 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

henrysheehy avatar Jan 15 '24 11:01 henrysheehy

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.

gpoore avatar Jan 15 '24 13:01 gpoore

Thank you, I appreciate your detailed reply!

henrysheehy avatar Jan 15 '24 15:01 henrysheehy