Oh my god.

I’ve spent the last 2 hours trying to get started taking notes for a class that has an exam tomorrow. I was taking them in Markdown when it occurred to me that it would be cool if I could then convert the file to pdf for viewing later. And of course, I had to configure this now. What followed was a horrific descent into dependency hell.

I was taking notes in vim. I heard about Pandoc, and how it has support for vim. I set about installing it using Pathogen.

So far so good. But. The moment I did vi lecture_notes.md, Pandoc complained that I need vim version >= 7.4. So then I installed MacVim, because this thread told me that was the right way to upgrade vim (and it makes sense).

$ brew install macvim
$ brew linkapps 

The last line makes MacVim show up in /Applications instead of just your /Cellar.

Aliased it for vim and vi. Tried opening lecture_notes.md again. No more complaints! Markdown looks pretty! All coloured!

All right, let’s try converting to pdf:

$ pandoc --from=markdown --to=pdf lecture_notes.md

And of course, that didn’t work. Apparently Pandoc uses LaTeX to convert to pdf. It needs a LaTeX engine. Sigh. Time to install one, then. I went to MacTeX and went about trying to download. And… the smallest download is ~100 MB. Really?! Oh well. Download and install. Now everything, finally, works.

Pandoc’s pretty nice. I don’t have to rely on sketchy online converters any more, which is great. I can do something like

$ pandoc -t latex lecture_notes.md -o lecture_notes.pdf

Or I can do it directly from vim:

:Pandoc pdf

And it creates original-filename.pdf in my directory.

Update (March 2021): I had to once again go from .md to .pdf because of an issue with IETF Datatracker when uploading markdown minutes, so I had to

brew install pandoc
brew install --cask mactex
ln -s -f /usr/local/texlive/2020/bin/x86_64-darwin/pdflatex /usr/local/bin 
pandoc pearg-minutes-110.md -o pearg-minutes-110.pdf