rundel / md4r

An R wrapper for the md4c markdown parsing library
https://rundel.github.io/md4r/
Other
4 stars 1 forks source link

Backslash before full stop after inline code #9

Closed krlmlr closed 5 months ago

krlmlr commented 5 months ago

Is this intended? The last substantial roundtrip deviation for fledge's NEWS.md, need to review other packages' files too.

library(md4r)

md <- parse_md("- Test `func()`.")
md
#> md_block_doc [flags: "MD_DIALECT_COMMONMARK"]
#> └── md_block_ul [tight: 1, mark: "-"]
#>     └── md_block_li
#>         ├── md_text_normal - "Test "
#>         ├── md_span_code
#>         │   └── md_text_code - "func()"
#>         └── md_text_normal - "."
writeLines(to_md(md))
#> - Test `func()`\.

Created on 2024-03-10 with reprex v2.1.0

rundel commented 5 months ago

Should be fixed now - its a bit tricky to detect in the AST since escaping needs to be inferred by context, I'm sure there are some edge cases with the current implementation but it doesn't run afoul of any of the existing test cases.