Closed maelle closed 1 year ago
OMG why didn't I see this!?
Maybe because you write clear text that doesn't need footnotes?!
Maybe because you write clear text that doesn't need footnotes?!
*wheezing*
Funny enough, the most recent update of {commonmark} has "footnotes" support, but it's a bit strange:
txt <- c("a statement[^1][^2]\n", "[^1]: this is true", "[^2]: this is false")
commonmark::markdown_xml(txt, footnotes = TRUE) |> 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">a statement</text>
#> <<unknown> />
#> <<unknown> />
#> </paragraph>
#> <<unknown>>
#> <paragraph>
#> <text xml:space="preserve">this is true</text>
#> </paragraph>
#> </<unknown>>
#> <<unknown>>
#> <paragraph>
#> <text xml:space="preserve">this is false</text>
#> </paragraph>
#> </<unknown>>
#> </document>
Created on 2023-03-22 with reprex v2.0.2
OH I think I know what's going on! {tinkr} sees this footnote as a relative link:
lines <- c("[thing] lala[^1] blabla", "", "[thing]: what", "[^1]: pof")
temp_file <- withr::local_tempfile()
brio::write_lines(lines, temp_file)
tinkr::yarn$new(temp_file)$show()
#> [thing][thing] lala[^1][^1] blabla
#>
#> [thing]: what
#> [^1]: pof
Created on 2023-03-28 with reprex v2.0.2
The happy thing is that we can fix this with a little XSLT!
For reference, the fix for this issue is in https://github.com/ropensci/tinkr/pull/94/commits/beb8277a641fe8e798cdf27b5c5f04cf59b45a54
this has been fixed in #94
thanks so much!
Created on 2023-02-23 with reprex v2.0.2