XML Typst
An experiment in typsetting from XML with Typst.
Last week, I described an idea I had for modeling Typst with XML. I spent a few more evenings exploring those ideas and pushed it to a public repository: https://codeberg.org/ndw/XMLTypst. A bit more effort would be required to make it into something practical, but it seems entirely possible.
The repository contains the model framework and a couple of toy stylesheets for publishing from (tiny subsets) of HTML or DocBook with Typst.
In the end, I wanted more information from the Typst documentation than I was conveniently getting with Invisible XML, so I replaced that with an XProc pipeline that operates directly on the markup in the Typst documentation pages. (That allows me to extract information about settable properties and required properties that isn’t available in the function signature alone.) The actual Typst documentation sure seems like it’s at least partly generated from some other description of the data model, but a quarter of an hour poking around the Typst repo did not lead me to it.
That was a nice exercise in puzzle pieces as well, though. XProc happily loads HTML where it’s easy to query and transform with XSLT before writing out the results you need.
(I’m on holiday for the next couple of weeks, so there may be more pub signs than markup posts in the immediate future, but I’ll see what I can manage next Monday!)