ropensci / tinkr

Convert (R)Markdown files to XML, edit them, write them back as (R)Markdown
https://docs.ropensci.org/tinkr
GNU General Public License v3.0
57 stars 3 forks source link

preserve bare links in markdown #115

Closed zkamvar closed 6 months ago

zkamvar commented 6 months ago

This preserves bare links in markdown. The XML version of markdown does not differentiate between [link.url](link.url) and <link.url>, which leads to a transformation of the latter into the former during a roundtrip.

This will fix that issue to the best of our ability by forcing all links that have the same text and destination to be rendered as <link>:

f <- textConnection("[good link](https://example.com)\nbare link: https://example.com\nbracketed link: <https://example.com>") 
y <- tinkr::yarn$new(f); close(f) 
y$show()    
#> [good link](https://example.com)
#> bare link: <https://example.com>
#> bracketed link: <https://example.com>

Created on 2024-05-22 with reprex v2.1.0

This will fix #59

zkamvar commented 6 months ago

I'm going to merge this because it is also fairly low-stakes.