I like Markdown, it makes it easy to write documents without focusing on the mundane details. For this reason I’ve been using Madoko, which allows to write documents in Markdown and convert them to LaTeX and optionally PDF.

But then today the Madoko website wasn’t working properly right when I needed to output a document. Which was my main concern with online tools: they work fine most of the time, until they don’t. Luckily, Madoko is open source and you can compile .mdk files yourself by downloading the command line tool. I like using nvm on Linux for using nodejs, so off to Bash on Windows.

npm install madoko -g
madoko --pdf document.mdk

…and of course this fails because I don’t have xelatex installed. I do have TexLive, but it’s on Windows. But wait, isn’t Bash on Windows supposed to be able to run Windows executables? Of course, I never tried this for anything other than opening notepad.exe when showing off Bash on Windows to friends and didn’t really expect Bash on Windows to be able to do more complex things. But what if?

sudo ln -s /mnt/c/texlive/2017/bin/win32/xelatex.exe /usr/bin/xelatex
madoko --pdf document.mdk

I was actually surprised to see it work completely flawlessly. Of course, my .mdk file was a simple file without any external references and this may fail for more complex workflows, but it’s pretty impressive how far Bash on Windows has come. I’ve occasionally run Linux commands on Windows like bash -c 'telnet -t vtnt nyancat.dakko.us' but it’s good to know that it can go both ways.