npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@peaceroad/markdown-it-footnote-here

v0.4.0

Published

A markdown-it plugin. This generate aside[role|doc-footnote] element just below the footnote reference paragraph.

Readme

markdown-it-footnote-here

This is markdown-it plugin. And, this plugin is a further fork of markdown-it-footnote-here, which is a fork of the original markdown-it-footnote plugin.

This plugin inserts footnotes just below paragraphs.

The input Markdown and the output HTML are as follows.

Markdown:

A paragraph.[^1]

[^1]: A footnote.

A paragraph.

HTML:

<p>A paragraph.<a href="#fn1" id="fn-ref1" class="fn-noteref" role="doc-noteref">[1]</a></p>
<aside id="fn1" class="fn" role="doc-footnote">
<p><a href="#fn-ref1" class="fn-backlink" role="doc-backlink">[1]</a> A footnote.</p>
</aside>
<p>A paragraph.</p>

Notice.

  • When multiple instances of the same footnote number appear in the main content, the default behavior is that the backlink from the footnote will refer to the first instance.
  • When the same footnote/endnote label is defined multiple times, behavior is controlled by duplicateDefinitionPolicy (default: warn).

Endnotes

When a footnote label starts with the endnote prefix (default: en-), it is collected at the end of the document and rendered as endnotes. The reference/backlink label for endnotes is prefixed by endnotesLabelPrefix (default: E), so endnotes appear as [E1], [E2], ...

Markdown:

A paragraph.[^en-1]

[^en-1]: A endnote.

A paragraph.

HTML:

<p>A paragraph.<a href="#en1" id="en-ref1" class="en-noteref" role="doc-noteref">[E1]</a></p>
<p>A paragraph.</p>
<section aria-label="Notes" id="endnotes" role="doc-endnotes">
<ol>
<li id="en1">
<p><a href="#en-ref1" class="en-backlink" role="doc-backlink">[E1]</a> A endnote.</p>
</li>
</ol>
</section>

Use

import mdit from 'markdown-it'
import mditFootnoteHere from '@peaceroad/markdown-it-footnote-here'

const md = mdit().use(mditFootnoteHere)
md.render(/*...*/) // See examples above

Install

npm install @peaceroad/markdown-it-footnote-here

Options

  • beforeSameBacklink (boolean): false by default. When true, duplicate footnote references will use suffixes (a, b, ... z, aa, ab, ...) and generate matching backlinks in footnote definitions.
  • afterBacklink (boolean): false by default. If true, backlinks (↩) are placed at the end of the footnote content instead of before it.
    • Note: If beforeSameBacklink is also true, both backlink styles are rendered (before-label links and trailing ↩ links). Use one style if you need a cleaner output.
  • afterBacklinkContent (string): The content for the backlink (default: '↩').
  • afterBacklinkWithNumber (boolean): If true, backlink will show a number or letter suffix.
  • afterBacklinkSuffixArabicNumerals (boolean): If true, backlink suffix uses numbers (1, 2, ...) instead of letters (a, b, ...).
  • afterBacklinkAriaLabelPrefix (string): Prefix for aria-label of backlink (default: 'Back to reference ').
    • Breaking change: afterBacklinkdAriaLabelPrefix (old typo key) has been removed.
  • labelBra (string): Bracket to use before footnote number (default: '[').
  • labelKet (string): Bracket to use after footnote number (default: ']').
  • labelSupTag (boolean): If true, wraps footnote reference in <sup> tag.
  • backLabelBra (string): Bracket to use before backlink number (default: '[').
  • backLabelKet (string): Bracket to use after backlink number (default: ']').
  • endnotesPrefix (string): Prefix that marks a footnote as an endnote (default: 'en-').
  • endnotesLabelPrefix (string): Label prefix for endnote refs/backlinks (default: 'E', e.g., [E1]).
  • endnotesSectionId (string): id attribute for the endnotes section wrapper; omitted when empty (default: 'endnotes').
  • endnotesSectionClass (string): class attribute for the endnotes section wrapper; omitted when empty (default: '').
  • endnotesSectionAriaLabel (string): Used as aria-label when endnotesUseHeading is false. When endnotesUseHeading is true, this value becomes the heading text (default: 'Notes').
  • endnotesUseHeading (boolean): If true, render <h2>{endnotesSectionAriaLabel}</h2> and omit aria-label. If false (default), omit the heading and set aria-label when provided.
  • duplicateDefinitionPolicy (string): Policy for duplicate labels ('warn' | 'ignore' | 'strict', default: 'warn').
    • 'warn': keep first definition, mark note block with footnote-error, mark backlinks with footnote-error-backlink, and prepend <span class="footnote-error-message">...</span> in note content.
    • 'ignore': keep first definition and do not add warning classes/messages.
    • 'strict': throw an error on duplicate label.
  • duplicateDefinitionMessage (string): Message text used in warning span when policy is warn (default: '[Duplicate footnote label detected. Using the first definition.]').
  • injectErrorStyle (boolean): If true and policy is warn, inject a <style> block once per document for .footnote-error-message and .footnote-error-backlink (includes prefers-color-scheme and forced-colors handling). Default: false.
  • Diagnostics: when duplicates are detected, details are collected in env.footnoteHereDiagnostics.duplicateDefinitions.
  • Security note: option strings used in HTML output are escaped before rendering (labels, aria/id/class values, heading text, backlink content/message).
  • env.docId note: if provided, it is URL-encoded and applied consistently to note/ref ids to keep links valid and safe.
    • Runtime note: when using env.docId, prefer a new env object per render; changing env.docId on a reused object may keep prior cached id parts.