Skip to content

Instantly share code, notes, and snippets.

@nimdaghlian
nimdaghlian / fnprocess.php
Last active February 28, 2022 03:55
Renumbers footnotes in a markdown file in sequential order
<?php
// This renumbers footnotes in a markdown file in the order they appear, both in the text and citations
// Insert new footnotes in the order in which they should appear, in both text and citation
// Use a unique identifier for each new footnote ie [^fn1a], [^fn2a], etc.
// Place your footnotes at the end of the file with your full text.
// Separate them from the main text with the header `# Footnotes`
//
// This is meant to be run from the command line
// Run "php fnprocess.php -fFILENAME.MD" where FILENAME.MD is the name of the input file