r-lib / commonmark

High Performance CommonMark and Github Markdown Rendering in R
https://docs.ropensci.org/commonmark/
Other
88 stars 11 forks source link

Any way to flag escaped characters on input? #20

Open zkamvar opened 1 year ago

zkamvar commented 1 year ago

commonmark supports both bare square brackets and escaped square brackets. When the enter the parser, there's no indication which set of brackets were escaped and which ones were bare:

commonmark::markdown_xml("[bare brackets] \\[escaped brackets\\]") |> writeLines()
#> <?xml version="1.0" encoding="UTF-8"?>
#> <!DOCTYPE document SYSTEM "CommonMark.dtd">
#> <document xmlns="http://commonmark.org/xml/1.0">
#>   <paragraph>
#>     <text xml:space="preserve">[bare brackets] [escaped brackets]</text>
#>   </paragraph>
#> </document>

Created on 2022-09-19 with reprex v2.0.2

Is there a way to have the parser indicate which characters were escaped in the source document?

jeroen commented 1 year ago

You would have to ask upstream in https://github.com/commonmark/cmark