Closed yihui closed 1 year ago
Good catch. Seemingly this is an option in the parser, not sure why. I have now exposed the option (or should we just enable it by default globally)?
commonmark::markdown_html('a[^1] \n\n[^1]: test footnote', footnotes = TRUE)
# [1] "<p>a<sup class=\"footnote-ref\"><a href=\"#fn-1\" id=\"fnref-1\" data-footnote-ref>1</a></sup></p>\n<section class=\"footnotes\" data-footnotes>\n<ol>\n<li id=\"fn-1\">\n<p>test footnote <a href=\"#fnref-1\" class=\"footnote-backref\" data-footnote-backref aria-label=\"Back to content\">↩</a></p>\n</li>\n</ol>\n</section>\n"
Thanks! I think it will be nice to enable it by default. However, the LaTeX output is not implemented yet: https://github.com/r-lib/commonmark/blob/97647b404b2628d199bc968e1940aa80f4df0d3b/src/cmark/latex.c#L447-L449
I don't know why it was not implemented, i.e., isn't it just \footnote{CONTENT}
?
I have no idea, you'd have to ask the folks at cmark-gfm. I guess it's not part of the official spec?
Okay. I'll ask there. Before LaTeX output is implemented, I think it may be better to disable this option by default for markdown_latex()
while enabling it for markdown_html()
.
BTW, it will be great if you can make a new CRAN release but there is no hurry (I spent some time on a clumsy implementation of footnotes in R before I dug into GFM's C code and discovered that GFM actually had this feature). Thanks again!
One more thing: do you have a plan to upgrade to 0.29.0.gfm.9? There have been some improvements like https://github.com/github/cmark-gfm/commit/c32ef78bae851cb83b7ad52d0fbff880acdcd44a.
OK I've upgraded to 0.29.0.gfm.9 now.
I can do a CRAN release any moment, if we agree to switch the default or not :)
Sounds great! I don't have a strong opinion on whether to enable footnotes
by default. It's simple enough for me to enable it by myself, and I'm okay with any decision your make. I only slightly prefer enabling it for markdown_html()
at this time.
OK in that case I will leave it disabled by now, such that there is no change of default behavior, and submit to CRAN now.
Perhaps we can enable it by default in future versions, but that would require more checking of reverse dependencies to make sure we don't break things.
that would require more checking of reverse dependencies to make sure we don't break things.
Absolutely.
Let's see if anyone could help with https://github.com/github/cmark-gfm/issues/314.
Ok it is on cran now.
Op vr 17 mrt. 2023 17:51 schreef Yihui Xie @.***>:
that would require more checking of reverse dependencies to make sure we don't break things.
Absolutely.
Let's see if anyone could help with github/cmark-gfm#314 https://github.com/github/cmark-gfm/issues/314.
— Reply to this email directly, view it on GitHub https://github.com/r-lib/commonmark/issues/22#issuecomment-1474122276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABUZ72IKVRUGZ6CE42MYFDW4SI7XANCNFSM6AAAAAAV5X7E2E . You are receiving this because you modified the open/close state.Message ID: @.***>
Perfect!
It seems that footnotes are supported in GFM:
but somehow this feature is not enabled in the R package?
And worse still, a footnote can be treated as a link definition:
@jeroen Do you know how to enable footnotes support? Thanks!