← Back to context

Comment by beej71

1 day ago

I use Markdown for all my books, currently. It used to be a custom XML format, but that was really annoying to type even with custom Vim keybindings.

I do wish Markdown were more capable, but it's a good lowest common denominator for HTML and PDF. Also Pandoc-flavored markdown is pretty decent.

My current flow is:

Markdown -> preprocess -> pandoc -> HTML

Markdown -> preprocess -> pandoc -> HTML -> page-splitter -> split HTML

Markdown -> preprocess -> pandoc -> LaTeX -> PDF

That last one is slow, and I'm hoping to replace it with Typst, probably:

Markdown -> preprocess -> pandoc -> docbook -> xlstproc -> typst -> PDF

I've tried other things like Sphinx and it's tough to find something that checks all the boxes I need.

In general, though, I'm pretty impressed with Typst. I wrote a test program that takes the XML output from cmark-gfm and converts it to Typst with xsltproc. It produces PDFs in orders of magnitude less time than Pandoc/LaTeX. I use that now for all my casual PDF documents. https://github.com/beejjorgensen/xml2typ

> I'm hoping to replace it with Typst

This might be stupid but is there a reason you want to go through docbook and xsltproc instead of setting --pdf-engine=typst?

  • Looks like it's getting there, but still needs some work. It's not obeying the book output or number sections. I can probably get the indexing going, though.

    Measured at 10x faster than LaTeX.

  • Yes. Two reasons:

    1) More control over the typst output... 2) I didn't know you could do that. :D :D :D

    I'll check it out--thanks for the pointer!

Repo is nice, thanks. Small nit: it would be nice to have included the final PDF output of your tool on `test.md` in the repo.