Nik Kantar

Saturday, January 8, 2022

Introducing mdut

I made a tiny tool for generating Markdown URL tags and want to tell you about it.

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
Copied to clipboard:
[TODO]: "Example Domain"

And here’s how to use it in Python:

>>> import mdut
>>> mdut.reference("")
'[TODO]: "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

The sequence Space, m, 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!

And that’s pretty much it. You can see more in the repo, and the package is available on PyPI.

Not Aristotle
Reversioning mdut