Update README w/ homebrew instructions
Add release config
Update Bun to 1.3.2
Keep numbered, reference-style Markdown links in sequential order. If you have a document like this:
Here's a [link][1].
[1]: https://link-a.com
Here's another [link][2].
[2]: https://link-b.com
And you add a new link at the beginning, like this:
Here's a [new link][3]. Here's a [link][1].
[1]: https://link-a.com
[3]: https://link-c.com
Here's another [link][2].
[2]: https://link-b.com
The result of running mdrenum --fix will be:
Here's a [new link][1]. Here's a [link][2].
[1]: https://link-c.com
[2]: https://link-a.com
Here's another [link][3].
[3]: https://link-b.com
brew tap dce/tapsbrew install mdrenumbrew upgrade mdrenummdrenum somewhere on your PATH (e.g., /usr/local/bin).Usage: mdrenum [options] [files...]
Arguments:
files files to scan (default: .md files in current directory + subdirectories)
Options:
-s, --stdin read content from STDIN, write to STDOUT (default: false)
-f, --fix update files to put links in sequential order (default: false)
-V, --version output the version number
-h, --help display help for command
mdrenum will report an error and won't update the file.mdrenum encounters multiple definitions with the same identifier, it will report an error and won't update the file.We use Bun to compile a standalone executable. The version is specified in .tool-versions. Compile the program with bun run build. The resulting executable will be bin/mdrenum, which you can copy to a directory on $PATH.
package.json and shown via mdrenum --version.v0.1.0 triggers four archives uploaded to the GitHub Release: mdrenum-linux-x64.tar.gz, mdrenum-linux-arm64.tar.gz, mdrenum-macos-x64.tar.gz, and mdrenum-macos-arm64.tar.gz. Each contains a single mdrenum executable.v<package.json version> (e.g., v0.1.0). The release workflow will fail if they do not match.Tests live in src/mdrenum.test.ts. Run them with bun test.
To instruct Helix to automatically renumber links on save, add the following to ~/.config/helix/languages.toml:
[[language]]
name = "markdown"
auto-format = true
formatter = { command = "mdrenum" , args = ["--stdin"] }
All credit to the unified collective for creating mdast, which is doing most of the heavy lifting here.