Pandoc is my savior

Philip Thomas K.

01 April 20

Back

I have varied usage of pandoc, but whenever I use it, it feels like I’m a miracle worker. Why? Because it does what it’s meant to do properly.

Recently, I was looking for something like PEP8 but for C. And I stumbled upon this link.

You’ve all stumbled across this kind of website before. It sort of looks like an article. It has a table of contents, sections, subsections. All that good stuff.

Most importantly, it holds vital information for those that search for it. But, the format is no where close to anything that aids reading. It just doesn’t look nice.

I wanted to turn the contents into a pdf. Not a very easy task to do myself. I would have to manually extract out the information from the webpage, and shove it into latex and do some configuration and what not.

That’s not very unix.

What is? This command:

pandoc -s -r html https://www.doc.ic.ac.uk/lab/cplus/cstyle.html --pdf-engine=xelatex -o 'ANSI C.pdf'

The output is beautiful. Proper justification, a sane font, and the right margins. It was exactly what I envisioned. All done in a single liner. Mind blown.

Best Regards,
Philip
Back