messense/typst-py

Incorporate scope `show`/`set` rules in `metadata` output

ntjess opened this issue · 1 comments

ntjess commented

Consider the following document:

#let mr(..args) = [#metadata(rect(..args))<rect>]
#mr(width: 5em, height: 5em, stroke: black)

#mr(width: 5em, height: 5em, stroke: black)

#set rect(stroke: rgb(255, 0, 0))
#show rect: it => it

#mr(width: 5em, height: 5em, fill: yellow)
#show rect: it => [Completely overridden!]
#mr(width: 5em, height: 5em, fill: yellow)

It would be ideal if the output of typst query file.typ "<rect>" could capture whatever content is about to be shown, not just what is passed directly. This allows the metadata to more accurately reflect what is actually present in the document. Currently, neither show rules or set rules are incorporated.

ntjess commented

Wrong repository, my apologies!