#Does anyone have a good Markdown → Typst workflow nailed down??

18 messages · Page 1 of 1 (latest)

signal cape
#

Wondering if anyone here has a preferred system for getting Markdown data into Typst over and over again. Pandoc seems to do a pretty decent job, but having to rip the styles it applies out and fix it with my own template every time is kind of a pain? Would be interested in a much more automated "pipeline" type solution!

cold solstice
#

What kind of markdown data are we talking about?

signal cape
signal cape
#

Headers, lists, some links, etc

cold solstice
#

then there is no better solution then to use a template, pandoc, and a simple script

signal cape
#

Looks like it's scripting time!

#

This might be more well suited to make a pandoc issue about... Really what I'd love is exactly their output but without the pandoc template for typst so I can use it with my own document styles / template

signal cape
#

Aha! The answer is to omit the --standalone (-s) flag from Pandoc and then it results in exactly what I want!

#

Well, consider this one answered :)

tough fossil
#

@signal cape How are you including your own styles/templates in your workflow with pandoc?

#

(I ask because I used to use markdown → pandoc → LaTeX + styles → PDF, and now I use markdown → my own translation scripts → typst + styles → PDF. And I'd be pleased to lose my own translation scripts in time.)

signal cape
#

@tough fossil Nothing fancy, just a simple shell script, but this is what I've got so far!

privacyPolicyTypst=$(pandoc webrecorder-privacy-policy.md -f markdown -t typst)
dataProcessingTypst=$(pandoc browsertrix-data-processing-addendum.md -f markdown -t typst)

# Concatinate & compile documents
{
    cat documentstyle.typ
    echo ""
    echo "$privacyPolicyTypst"
    echo ""
    echo "#pagebreak()"
    echo ""
    echo "$dataProcessingTypst"
} | typst compile --font-path "../common/fonts" - TEMP/output.pdf
#

Using this to compile our privacy policy and other related legal docs into a single PDF along with the sales form

#

After each document I'll probably insert a section from another .typ file to sign the document

#

All of the document theming lives in documentstyle.typ and omitting the --standalone pandoc flag just gives me 1-1 Markdown -> Typst output

#

Has been working well so far, but still working on a few things like ensuring that headers and text breaks nicer so we aren't left with weird issues like this.... Unsure how possible this is RN

tough fossil
#

Thanks, @signal cape. Simple enough, as you say.
I suppose I should really just switch to writing in Typst, but the issue is the 15 years of Markdown files I sometimes go back to.