I write a fair bit of Markdown. It powers all the content on this site and it’s all over GitHub and Slack, where I type most things I don’t type in my text editor. In the course of all this Markdown writing, I often find myself wanting to link elsewhere and then generating Markdown URL tags. While they’re not terrible to type out, it’s a bit tedious to have to:
So now I don’t have to!
mdut is a tiny little tool for generating Markdown URL tags from a given URL. It functions as both a standalone CLI tool and Python library.
Here’s what the CLI interaction looks like:
$ mdut https://example.com Copied to clipboard: [TODO]: https://example.com "Example Domain"
And here’s how to use it in Python:
>>> import mdut >>> mdut.reference("https://example.com") '[TODO]: https://example.com "Example Domain"'
And here’s how I use it from inside Neovim:
nnoremap <Leader>mr :!mdut -s reference nnoremap <Leader>mi :!mdut -s inline nnoremap <Leader>ms :!mdut -s slack
r drops me on the command row ready to paste the URL and press
Enter to execute it, and then I can just paste it!