with typst compile --features html --format html ..., I get
warning: block was ignored during HTML export
┌─ @preview/cetz:0.3.2/src/canvas.typ:18:90
I don’t see this explicitly mentioned on the roadmap for HTML, so I wonder if there is a way to do it. This would be very helpful for preparing lecture slides.
hmm, I’m not sure I’d do it like that. If I’m not mistaken, that would include the caption in the frame and thus make it part of the SVG image (not selectable, at least in most browsers, and inconsistent with non-cetz figures). – oh! I just noticed that actually doesn’t allow you to add a caption since all args are passed to CeTZ.
Also, the custom kind could lead to outline problems if the cetz drawing should be a regular image (or some other existing kind).
Here I use figure as a poor man’s custom type, so that cetz diagrams can be easily queried and configured with show rules. It’s not meant to include a caption. If the user wants the diagram in an actual figure, they’re expected to write figure(drawing(...), caption: ...). But I also like your version, it’s a simpler example.