Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@amanda-mitchell/remark-renumber-footnotes
Advanced tools
A remark-parse plugin that renumbers footnotes sequentially.
This is a remark-parse plugin that renumbers footnotes so that they're always sequential in order of when the reference first appears in the document.
yarn add @amanda-mitchell/remark-renumber-footnotes
Construct a unified parser and pass renumberFootnotes
to it as a plugin:
const unified = require('unified');
const markdown = require('remark-parse');
const remarkGfm = require('remark-gfm');
const {
renumberFootnotes,
} = require('@amanda-mitchell/remark-renumber-footnotes');
const html = require('remark-html');
const doc = `[^1]: Second
This is a document[^2] with[^2] a couple[^1] of footnotes[^foo].
[^foo]: Last item
[^2]: First
`;
const processor = unified()
.use(markdown)
.use(remarkGfm)
.use(renumberFootnotes)
.use(html)
.freeze();
processor.process(doc).then({ contents } => console.log(contents))
When run, this script will print
<p>This is a document<sup><a href="#user-content-fn-1" id="user-content-user-content-fnref-1" data-footnote-ref aria-describedby="user-content-footnote-label">1</a></sup> with<sup><a href="#user-content-fn-1" id="user-content-user-content-fnref-1-2" data-footnote-ref aria-describedby="user-content-footnote-label">1</a></sup> a couple<sup><a href="#user-content-fn-2" id="user-content-user-content-fnref-2" data-footnote-ref aria-describedby="user-content-footnote-label">2</a></sup> of footnotes<sup><a href="#user-content-fn-3" id="user-content-user-content-fnref-3" data-footnote-ref aria-describedby="user-content-footnote-label">3</a></sup>.</p>
<section data-footnotes class="footnotes"><h2 class="sr-only" id="user-content-footnote-label">Footnotes</h2>
<ol>
<li id="user-content-user-content-fn-1">
<p>First <a href="#user-content-fnref-1" data-footnote-backref="" aria-label="Back to reference 1" class="data-footnote-backref">↩</a> <a href="#user-content-fnref-1-2" data-footnote-backref="" aria-label="Back to reference 1-2" class="data-footnote-backref">↩<sup>2</sup></a></p>
</li>
<li id="user-content-user-content-fn-2">
<p>Second <a href="#user-content-fnref-2" data-footnote-backref="" aria-label="Back to reference 2" class="data-footnote-backref">↩</a></p>
</li>
<li id="user-content-user-content-fn-3">
<p>Last item <a href="#user-content-fnref-3" data-footnote-backref="" aria-label="Back to reference 3" class="data-footnote-backref">↩</a></p>
</li>
</ol>
</section>
By default, this plugin will modify footnotes with non-numeric identifiers. If you would like to disable this behavior you can pass
{ ignoreNonnumericFootnotes: true }
As the options
for this plugin.
FAQs
A remark-parse plugin that renumbers footnotes sequentially.
The npm package @amanda-mitchell/remark-renumber-footnotes receives a total of 5 weekly downloads. As such, @amanda-mitchell/remark-renumber-footnotes popularity was classified as not popular.
We found that @amanda-mitchell/remark-renumber-footnotes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.