I use a lot of markdown

I like writing in markdown.
So much so that I use it for everything.

  • Work documents
  • Personal documents
  • Books
  • Blog posts

Converting to pdf has been difficult

Even though I write in markdown, in a lot of situations, it’s easier to read something if it’s formatted as a pdf.

Converting has been a pain in the past.

One process I’ve used occasionally was to use pandoc to convert markdown to html. Then open it in a browser, and print or save as pdf. Yuk. I’ve also tried converting to docx, then opening in Word or Pages and saving as pdf. Similar yuk.

Doesn’t pandoc already output to pdf?

Yes, but it does it through LaTeX, and on many platforms you’ll need to install an additional tool for the pdf creation that pandoc will use. It’s a big pain though, and different on every platform.

Now it’s easy

It’s no longer difficult. And apparently hasn’t been difficult for a while. However, I’ve just recently learned about this process with typst.

Tools needed:

I’m using a mac, and both of these can be brew install-ed. They are also available for Windows and Linux. And both are free. And I think both are open source.

The process:

  • Use pandoc to convert from markdown to typst with the --to typst flag.
  • Use typest to compile to pdf.

That’s it.

pandoc something.md --to typst -o something.typ  
typst compile something.typ something.pdf 

Special handling needed?

See typst docs for any special settings you might need.

Thanks

Thanks to Matt Harrison for letting me know about typst.

Older post

New Blog, Who Dis?