Browser support to print HTML sucked. No page counter / max pages, no way to properly style headers and footers. Chrome 131 recently added CSS support for @page [1][2] and cross-references in the same doc (giving you the page number), which is a great step forward. I think this simplifies Markdown → PDF even more on the tooling side.
> From a technical point of view, WeasyPrint is a visual rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. WeasyPrint is free software made available under a BSD license.
Hmm, I wonder if you could use servo for a similar purpose.
I love Typst, but I've found its typesetting not quite on par with LaTeX last time I checked. Not sure why you wouldn't just convert your Markdown to LaTeX if you're not writing source code yourself anyhow. There's even a package that allows you to parse Markdown as part of your LaTeX build, which works really well in combination with Overleaf if you want this workflow available from anywhere with next to no preliminary setup.
I really wish there were more resources for Typst out there. The reference documentation seems comprehensive, but as somebody who is neither a developer nor experienced in LaTeX, I seem to need a bit more handholding.
I am currently finishing a similar project, producing PDF from original Markdown input, with the added difficulty that input is spread over many files and directories. I chose LaTeX as the typesetting engine, since I know it fairly well and learning a completely different engine (Typst) with no clear advantage made no sense. Pandoc did a fine job with the low-level conversion from Markdown to LaTeX; then other files combined the generated .tex files into a coherent complete work.
Actually, the task was more difficult, because the input should also be used to produce a website -- and mkdocs was used for this.
I have a list of problems that came up and required not-insignificant amount of work to be solved. Many of them were about the handling of images.
I can see why someone would prefer Typst over LaTeX when the source is written in Typst or LaTeX, but what are the advantages if your source document is in Markdown? Is there anything else beyond the (presumably) smaller install size of Typst?
When compiling the Markdown to PDF, you might want to customize the PDF template. That's arguably easier and more pleasant to do with a Typst template than a Latex template. Also the compilation with Typst is often much faster.
Typst is 2-3 orders of magnitude faster than latex, which for book-sized projects can be the difference between a minute and sub-second compilation time.
Something I found useful is that you can create a much more minimal pandoc template for typst than for latex. Obviously if familiar with latex it probably won't be an issue, but when I tried to make my own barebones pandoc template (i.e., stripping out beamer) I gave up.
I've similarly found the combination of pandoc + typst to be quite exciting. I've found it particularly useful for typesetting academic papers - I'm quite averse to word in general, don't require extensive mathematical typesetting support, and find latex to generally be quite unapproachable (just look at the size of the default pandoc template!), and so it gives me a method of making a decent pdf whilst simultaneously producing a .docx for my collaborators. Being able to track changes with git is also a huge advantage, although never had the chance to work with someone who is comfortable using git :(
The recently added support for PDF/A is also quite exciting, as I've never found a satisfactory solution to this with latex. Now I just wish journals would support markdown submissions...
Currently it only outputs PDF, PNG and SVG. The next release will have preliminary support for HTML. This will be a structured output so from there it will be easier to support other formats either directly or in post-processing e.g. through pandoc. Pandoc itself supports Typst input but I'm not sure how reliable that is.
Don’t know either, but some things are unrepresentable in the pandoc internal format. It can internally represent an intersection of all its supported formats.
[1] https://developer.chrome.com/blog/print-margins
[2] https://developer.mozilla.org/en-US/docs/Web/CSS/@page
reply