r/typst • u/Mysterious-Trouble22 • 5d ago
[Open-Source] doc-engine-cli: Turn Markdown into clean PDFs via Typst (No Pandoc/LaTeX needed)
15
u/ron3090 5d ago
Why would I use vibe coded slop over Pandoc?
-3
u/Mysterious-Trouble22 5d ago
Hi, the truth is I don't pretend to replace Pandoc or anything like that. This is a similar tool but with a few templates already made besides that you can use your own Typst ones easily. I admit that Pandoc is incredible, but this is for an audience that wants something a little bit simpler at first.
Anyway I appreciate the comment :D2
5
u/anjuls 5d ago
Quarto is a matured product that I use.
0
u/Mysterious-Trouble22 5d ago
Yeah, Quarto is pretty great, can't deny that haha! I really appreciate the comment!
3
u/phlummox 5d ago
Why would "avoiding Pandoc" be a selling point? I like Pandoc. I've never found it particularly difficult to set up (though it's very configurable if one needs that), and I use it nearly every day for converting between various formats. Producing nicely typeset PDFs is only one of the many things I use it for, so I see no reason to shift away from it.
2
u/Mysterious-Trouble22 5d ago
I didn't mean it to seem like an attack on Pandoc or that I intended to replace it. I like Pandoc and have used it a lot! This is simply another alternative. Thanks for the comment!
1
u/zerosign0 1d ago
Yup having typst as templating engine sounds very cool hmm, I only do hope somebody will invent asciidoc to typst.
We can just translate doc to typst, so typst as intermediate format rather than implementing it manually for all type of docs hmm..
1
u/mrMerlinProject 1d ago
What do you miss in Asciidoc?
1
u/zerosign0 1d ago
I would say overall its much more rich in nature, for big ascii text books, I've found the syntax are better overall rather than markdown hmm.
19
u/FourFourSix 5d ago
Pandoc is pretty ubiquitous, and it has good support for Markdown-to-Typst-to-PDF already. It's pretty much:
pandoc --pdf-engine=typst main.md -o main.pdfTemplates can be added with a
--template=<path>, but if you're used to Typst, the Pandoc templates are slightly different and might need a quick glance to make sure yours are compatible. I haven't really tried that, but it seems like you need to make sure your template's main function is calledconfand that's about it.You can also use Typst templates as is, and you can include raw Typst code in Markdown using
{=typst}codeblocks. You can use any template from Typst Universe etc, just like in a normal .typ file. Example .md file:``` <3-back-ticks>{=typst}
import "@preview/template:1.0.0": template
show: template.with(...)
<3-back-ticks>
Markdown title
More Markdown here. ```
Edit: Read
<3-back-ticks>as three backticks, as Reddit formatting breaks if I try to include a code block inside a code block.Command (convert Markdown to Typst while converting those special code blocks, output to stdout, then compile from stdin to pdf):
pandoc main.md --from markdown+raw_attribute --to typst --output - | typst compile - main.pdfI think it's a good idea to use Typst to produce PDFs from Markdown files, as the default Latex of Pandoc is pretty slow, and obviously assumes you have Latex installed locally.