Skip to content

Conversation

@zkamvar
Copy link

@zkamvar zkamvar commented Apr 5, 2024

I believe this will begin to address the issues in #341 and #316.

(Update 2023-04-17: I added id and destination attributes to these nodes based on what I saw in the html writer)

I have run make test and everything passes for me. I have additionally tested this on a minimal document:

---
title: "footnote"
---

let's insert a footnote[^1] and a duplicate[^1] another one[^foot]

[^1]: first footnote with a number

[^foot]: second footnote with a label
    
    and

    a linebreak.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
  <thematic_break />
  <heading level="2">
    <text xml:space="preserve">title: &quot;footnote&quot;</text>
  </heading>
  <paragraph>
    <text xml:space="preserve">let's insert a footnote</text>
    <fnref id="fnref-1" destination="fn-1" />
    <text xml:space="preserve"> and a duplicate</text>
    <fnref id="fnref-1-2" destination="fn-1" />
    <text xml:space="preserve"> another one</text>
    <fnref id="fnref-foot" destination="fn-foot" />
  </paragraph>
  <fn id="fn-1">
    <paragraph>
      <text xml:space="preserve">first footnote with a number</text>
    </paragraph>
  </fn>
  <fn id="fn-foot">
    <paragraph>
      <text xml:space="preserve">second footnote with a label</text>
    </paragraph>
    <paragraph>
      <text xml:space="preserve">and</text>
    </paragraph>
    <paragraph>
      <text xml:space="preserve">a linebreak.</text>
    </paragraph>
  </fn>
</document>

I was not sure of what type labels to give the nodes, so I named them fnref and fn for the reference and the definition, respectively. If there is a more relevant precedent, then let's go for that.

@zkamvar
Copy link
Author

zkamvar commented May 5, 2024

Pinging this again to see if there are any maintainers who can review this.

@zkamvar
Copy link
Author

zkamvar commented May 27, 2024

Bumping this again to see if I can get a review.

@yoonghm
Copy link

yoonghm commented Sep 13, 2024

@zkamvar, how did you execute cmark-gfm to generate the html in your comment above?

I guess you use cmark-fsm <input_file> --extension footnotes

jeroen added a commit to r-lib/commonmark that referenced this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants