Incorrect Footnote Order
See original GitHub issueSubject of the issue
I get an incorrect footnote order when I mix inline and regular footnotes.
Your environment
- Windows 10 x64
- “rehype-stringify”: “^5.0.0”, “remark-parse”: “^6.0.3”, “remark-rehype”: “^4.0.0”, “unified”: “^7.1.0”, “unified-stream”: “^1.0.4”
- Node 8.15.1
Steps to reproduce
The code (essentially lifted from the guide):
const options = {
footnotes: true,
gfm: true
};
const processor = unified()
.use(parse, options)
.use(remark2rehype)
.use(html)
fs.readFile('sample.md', 'utf8', function(err, data) {
processor.process(data)
.then(function(out) {
fs.writeFile('sample.html', out, 'utf8', function(err){
if (err) throw err;
return;
})
})
.catch(function(err) {
console.log(err);
});
});
and input file sample.md
:
Some text[^foo bar]
More text[^x]
[^x]: baz cuux
Actual behaviour
sample.html
<p>Some text<sup id="fnref-1"><a href="#fn-1" class="footnote-ref">1</a></sup></p>
<p>More text<sup id="fnref-x"><a href="#fn-x" class="footnote-ref">x</a></sup></p>
<div class="footnotes">
<hr>
<ol>
<li id="fn-x">baz cuux<a href="#fnref-x" class="footnote-backref">↩</a></li>
<li id="fn-1">foo bar<a href="#fnref-1" class="footnote-backref">↩</a></li>
</ol>
</div>
Expected behaviour
<p>Some text<sup id="fnref-1"><a href="#fn-1" class="footnote-ref">1</a></sup></p>
<p>More text<sup id="fnref-x"><a href="#fn-x" class="footnote-ref">x</a></sup></p>
<div class="footnotes">
<hr>
<ol>
<li id="fn-1">foo bar<a href="#fnref-1" class="footnote-backref">↩</a></li>
<li id="fn-x">baz cuux<a href="#fnref-x" class="footnote-backref">↩</a></li>
</ol>
</div>
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Footnotes do not follow numbering order at bottom of page
Please try clicking on the Review tab of the Ribbon, then on the Accept icon and choosing Accept All Changes in Document. On...
Read more >MS Word footnotes skip numbers when using Track Changes
In the Review pane, in Tracking select Simple Markup. The footnote numbering will still be out of sequence (due to a deleted reference)....
Read more >Changing the Way Footnotes Are Numbered - Word Ribbon Tips
In Word, footnotes can be automatically numbered from 1 through the number of footnotes in the document. Thus, if your document contains 14 ......
Read more >Footnote numbering incorrect in Word - Knowl365
Solution for incorrect order footnotes by removing section breaks · Click on Replace in the Home tab · In the Find and Replace...
Read more >Incorrect Footnote Order - JAMA Network
Incorrect Footnote Order ... In the Original Investigation entitled “Association of the 2011 ACGME Resident Duty Hour Reform With General Surgery ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Remark is parsing the references as expected. https://astexplorer.net/#/gist/471584ba12aa4e52757dcbb9e11bd275/59c1f5114ec43c6c688990d5fd3bba1a38392153
Transferring this to
remark-rehype
, which handles more around the output to HTML.All these questions are valid. And you can do all these things with markdown! Two notes that you may find interesting:
Thank you!