{"id":13533861,"url":"https://github.com/markdown-it/markdown-it-footnote","last_synced_at":"2025-05-15T12:02:47.893Z","repository":{"id":25325850,"uuid":"28752881","full_name":"markdown-it/markdown-it-footnote","owner":"markdown-it","description":"Footnotes plugin for markdown-it markdown parser ","archived":false,"fork":false,"pushed_at":"2024-07-21T18:43:13.000Z","size":48,"stargazers_count":227,"open_issues_count":4,"forks_count":60,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-11T05:25:40.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://markdown-it.github.io/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markdown-it.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-03T19:42:40.000Z","updated_at":"2025-05-02T11:02:17.000Z","dependencies_parsed_at":"2023-12-18T18:37:33.996Z","dependency_job_id":"58b9ad8e-c045-4bd0-9d85-8d549d584dbc","html_url":"https://github.com/markdown-it/markdown-it-footnote","commit_stats":{"total_commits":40,"total_committers":6,"mean_commits":6.666666666666667,"dds":"0.42500000000000004","last_synced_commit":"fe6c169c72b9f4d6656b10aa449128456f5a990e"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-footnote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-footnote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-footnote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-footnote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markdown-it","download_url":"https://codeload.github.com/markdown-it/markdown-it-footnote/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253789387,"owners_count":21964659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:01:23.798Z","updated_at":"2025-05-15T12:02:47.832Z","avatar_url":"https://github.com/markdown-it.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized","JavaScript"],"sub_categories":["Uncategorized"],"readme":"# markdown-it-footnote\n\n[![CI](https://github.com/markdown-it/markdown-it-footnote/actions/workflows/ci.yml/badge.svg)](https://github.com/markdown-it/markdown-it-footnote/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/markdown-it-footnote.svg?style=flat)](https://www.npmjs.org/package/markdown-it-footnote)\n[![Coverage Status](https://img.shields.io/coveralls/markdown-it/markdown-it-footnote/master.svg?style=flat)](https://coveralls.io/r/markdown-it/markdown-it-footnote?branch=master)\n\n\u003e Footnotes plugin for [markdown-it](https://github.com/markdown-it/markdown-it) markdown parser.\n\n__v2.+ requires `markdown-it` v5.+, see changelog.__\n\nMarkup is based on [pandoc](http://johnmacfarlane.net/pandoc/README.html#footnotes) definition.\n\n__Normal footnote__:\n\n```\nHere is a footnote reference,[^1] and another.[^longnote]\n\n[^1]: Here is the footnote.\n\n[^longnote]: Here's one with multiple blocks.\n\n    Subsequent paragraphs are indented to show that they\nbelong to the previous footnote.\n```\n\nhtml:\n\n```html\n\u003cp\u003eHere is a footnote reference,\u003csup class=\"footnote-ref\"\u003e\u003ca href=\"#fn1\" id=\"fnref1\"\u003e[1]\u003c/a\u003e\u003c/sup\u003e and another.\u003csup class=\"footnote-ref\"\u003e\u003ca href=\"#fn2\" id=\"fnref2\"\u003e[2]\u003c/a\u003e\u003c/sup\u003e\u003c/p\u003e\n\u003cp\u003eThis paragraph won’t be part of the note, because it\nisn’t indented.\u003c/p\u003e\n\u003chr class=\"footnotes-sep\"\u003e\n\u003csection class=\"footnotes\"\u003e\n\u003col class=\"footnotes-list\"\u003e\n\u003cli id=\"fn1\"  class=\"footnote-item\"\u003e\u003cp\u003eHere is the footnote. \u003ca href=\"#fnref1\" class=\"footnote-backref\"\u003e↩\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli id=\"fn2\"  class=\"footnote-item\"\u003e\u003cp\u003eHere’s one with multiple blocks.\u003c/p\u003e\n\u003cp\u003eSubsequent paragraphs are indented to show that they\nbelong to the previous footnote. \u003ca href=\"#fnref2\" class=\"footnote-backref\"\u003e↩\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/section\u003e\n```\n\n__Inline footnote__:\n\n```\nHere is an inline note.^[Inlines notes are easier to write, since\nyou don't have to pick an identifier and move down to type the\nnote.]\n```\n\nhtml:\n\n```html\n\u003cp\u003eHere is an inline note.\u003csup class=\"footnote-ref\"\u003e\u003ca href=\"#fn1\" id=\"fnref1\"\u003e[1]\u003c/a\u003e\u003c/sup\u003e\u003c/p\u003e\n\u003chr class=\"footnotes-sep\"\u003e\n\u003csection class=\"footnotes\"\u003e\n\u003col class=\"footnotes-list\"\u003e\n\u003cli id=\"fn1\"  class=\"footnote-item\"\u003e\u003cp\u003eInlines notes are easier to write, since\nyou don’t have to pick an identifier and move down to type the\nnote. \u003ca href=\"#fnref1\" class=\"footnote-backref\"\u003e↩\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/section\u003e\n```\n\n\n## Install\n\nnode.js, browser:\n\n```bash\nnpm install markdown-it-footnote --save\nbower install markdown-it-footnote --save\n```\n\n## Use\n\n```js\nvar md = require('markdown-it')()\n            .use(require('markdown-it-footnote'));\n\nmd.render(/*...*/) // See examples above\n```\n\n_Differences in browser._ If you load script directly into the page, without\npackage system, module will add itself globally as `window.markdownitFootnote`.\n\n\n### Customize\n\nIf you want to customize the output, you'll need to replace the template\nfunctions. To see which templates exist and their default implementations,\nlook in [`index.js`](index.js). The API of these template functions is out of\nscope for this plugin's documentation; you can read more about it [in the\nmarkdown-it\ndocumentation](https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md#renderer).\n\nTo demonstrate with an example, here is how you might replace the `\u003chr\u003e` that\nthis plugin emits by default with an `\u003ch4\u003e` emitted by your own template\nfunction override:\n\n```js\nconst md = require('markdown-it')().use(require('markdown-it-footnote'));\n\nmd.renderer.rules.footnote_block_open = () =\u003e (\n  '\u003ch4 class=\"mt-3\"\u003eFootnotes\u003c/h4\u003e\\n' +\n  '\u003csection class=\"footnotes\"\u003e\\n' +\n  '\u003col class=\"footnotes-list\"\u003e\\n'\n);\n```\n\nHere's another example that customizes footnotes for epub books:\n\n```js\nconst backrefLabel = 'back to text';\n\nconst epubRules = {\n  footnote_ref: ['\u003ca', '\u003ca epub:type=\"noteref\"'],\n  footnote_open: ['\u003cli', '\u003cli epub:type=\"footnote\"'],\n  footnote_anchor: ['\u003ca', `\u003ca aria-label=\"${backrefLabel}\"`],\n}\n\nObject.keys(epubRules).map(rule =\u003e {\n  let defaultRender = md.renderer.rules[rule];\n  md.renderer.rules[rule] = (tokens, idx, options, env, self) =\u003e {\n    return defaultRender(tokens, idx, options, env, self).replace(...epubRules[rule]);\n  }\n})\n```\n\n## License\n\n[MIT](https://github.com/markdown-it/markdown-it-footnote/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkdown-it%2Fmarkdown-it-footnote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkdown-it%2Fmarkdown-it-footnote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkdown-it%2Fmarkdown-it-footnote/lists"}