# remark-numbered-footnotes

> This plugin replaces the footnote references with a number sequence (starting from 1) in the same order as the footnote definitions (**not** the footnote references).

Latest version **3.1.1** (published 2024-04-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install remark-numbered-footnotes
pnpm add remark-numbered-footnotes
yarn add remark-numbered-footnotes
bun add remark-numbered-footnotes
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2024-04-27 |
| First published | 2017-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Victor Felder |
| Maintainers | situphen, talone |
| Keywords | remark |

## Links

- npm: https://www.npmjs.com/package/remark-numbered-footnotes
- Repository: https://github.com/zestedesavoir/zmarkdown.git#master
- Homepage: https://github.com/zestedesavoir/zmarkdown/tree/master#readme
- Issues: https://github.com/zestedesavoir/zmarkdown/issues
- npm.io page: https://npm.io/package/remark-numbered-footnotes

## Dependencies (1)

- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^2.0.3

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 3.1.1 (latest) — 2024-04-27
- 3.1.0 — 2024-04-20
- 3.0.0 — 2021-02-14
- 2.0.0 — 2020-02-03
- 1.1.0 — 2019-08-29
- 1.0.12 — 2019-07-27
- 1.0.11 — 2019-04-14
- 1.0.10 — 2019-02-04
- 1.0.9 — 2018-11-23
- 1.0.8 — 2018-10-04
- 1.0.7 — 2018-08-09
- 1.0.6 — 2018-07-20
- 1.0.5 — 2018-03-06
- 1.0.4 — 2018-01-20
- 1.0.3 — 2018-01-19
- … 18 more at https://npm.io/package/remark-numbered-footnotes/versions

## README

This plugin replaces the footnote references with a number sequence (starting from 1) in the same order as the footnote definitions (**not** the footnote references).

Reordering the definitions (usually put at the end of the document in the Markdown source) will therefore let you reorder the sequence.

This is useful if you want your footnotes to be superscript numbers without having to manually enter them while keeping the benefit of using strings that make sense to you in your Markdown source.

# Warning

If you are using this plugin, your project is most certainly relying on [mdast-util-to-hast](https://github.com/syntax-tree/mdast-util-to-hast). Run `npm ls mdast-util-to-hast` if you're unsure.
Starting from `mdast-util-to-hast@6.0.0`, the [footnote order changed](https://github.com/syntax-tree/mdast-util-to-hast/commit/fd38c45421bbec497f56e5c624eb8652d3a3bba4). Before `6.0.0`, footnotes were following the order in which they were defined, starting from `6.0.0` they follow the order of the references.

```md
a[^first_footnote_reference]

b[^`b` second footnote reference but first footnote definition]

c[^last_footnote_reference]

[^last_footnote_reference]: `c` last footnote reference but second footnote definition
[^first_footnote_reference]: `a` first footnote reference but last footnote definition
```

Before `6.0.0`:

![image](https://user-images.githubusercontent.com/2022803/73589529-7207e980-44d7-11ea-8c67-cd8a20d961fe.png)

After `6.0.0`:

![image](https://user-images.githubusercontent.com/2022803/73589535-7cc27e80-44d7-11ea-90e0-3e0e0dbac87c.png)

In the HTML ordered list, the list items 1/2/3 don't match the footnote references numbers anymore.

To avoid this issue you can either use older versions of your dependencies (not recommended) or visit the HAST tree after `mdast-util-to-hast` to fix the footnote orders (recommended).
[Here is an example](https://github.com/zestedesavoir/zmarkdown/blob/7edd73057aba4eba52600106c6f8511619f045bd/packages/zmarkdown/common.js#L175-L206).
This way the above markdown will always generate HTML with matching footnote list items and footnote numbered references as can be seen below:

![image](https://user-images.githubusercontent.com/2022803/73589529-7207e980-44d7-11ea-8c67-cd8a20d961fe.png)

---
_Source: https://npm.io/package/remark-numbered-footnotes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
