{"id":15938439,"url":"https://github.com/whyboris/fix-markdown-footnotes","last_synced_at":"2025-07-27T12:38:38.480Z","repository":{"id":167990245,"uuid":"643622572","full_name":"whyboris/Fix-Markdown-Footnotes","owner":"whyboris","description":"CLI to re-number markdown footnotes into correct order","archived":false,"fork":false,"pushed_at":"2024-11-10T16:11:44.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-10T17:21:26.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/whyboris.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-05-21T18:39:34.000Z","updated_at":"2024-11-10T16:11:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"d19b1a9e-9faa-4bef-9b10-416d4d5030cd","html_url":"https://github.com/whyboris/Fix-Markdown-Footnotes","commit_stats":null,"previous_names":["whyboris/fix-markdown-footnotes"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2FFix-Markdown-Footnotes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2FFix-Markdown-Footnotes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2FFix-Markdown-Footnotes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2FFix-Markdown-Footnotes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whyboris","download_url":"https://codeload.github.com/whyboris/Fix-Markdown-Footnotes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230038879,"owners_count":18163311,"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-10-07T05:40:24.234Z","updated_at":"2024-12-16T23:10:19.886Z","avatar_url":"https://github.com/whyboris.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/fix-markdown-footnotes.svg)](http://badge.fury.io/js/fix-markdown-footnotes)\n\n# Fix Markdown Footnotes\n\n`fmf` is a *CLI* that will reorder foonotes chronologically.\n\n```md\n# Before\n\nHello[^7] world[^3]. These[^2] are[^2b] unordered.[^hi]\n\n# After\n\nHello[^1] world[^2]. These[^3] are[^4] unordered.[^5]\n```\n\n## Try without installing\n\n```sh\nnpx fix-markdown-footnotes your-file.md\n```\n\n## Install\n\n```sh\nnpm install -g fix-markdown-footnotes\n```\n\n## Use\n\n```sh\nfmf article.md\n```\n\nor to fix all *Markdown* documents in your directory:\n\n```sh\nfmf *\n```\n\nIf that fails, please try:\n\n```sh\nfmf '*'\n```\n\n## Algorithm\n\nUsing the `/(\\[\\^[^\\]]*])/g` regex we detect all instances of footnotes and confirm there is an even number of matches. Then we generate replacement values (via mapping to intermediate unique hashes) starting with 1 in order of appearance. Finally we write the new file contents, replacing the old file.\n\n## Developing\n\nRun `npm start` to test locally. Pass in a file: `npm start test.md` to run the script on the file.\n\nTo install a custom version of `fmf`, adjust the script to your liking by editing `index.js` and then run `npm run global`. Now when you execute `fmf` you'll be running your version of the script.\n\n## Notes\n\nRead the *MarkdownGuide.org* details about [footnotes](https://www.markdownguide.org/extended-syntax/#footnotes).\n\n- the CLI will ignore the *node_modules* folder\n- the CLI will not change the order of the footnotes at the bottom of the document\n- the CLI will not fix duplicate footnote numbers: having `Hi[^4] lol[^4]` is not proper Markdown.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhyboris%2Ffix-markdown-footnotes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhyboris%2Ffix-markdown-footnotes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhyboris%2Ffix-markdown-footnotes/lists"}