typst-hs icon indicating copy to clipboard operation
typst-hs copied to clipboard

Better support for Typst `auto`

Open sghng opened this issue 4 months ago • 2 comments

Currently we do have VAuto defined, but it works quite different from what Typst works.

In Typst, auto values are realized when it's actual rendered. For example, if I do #stroke().paint, I will see auto instead of an actual color.

To have support for more Typst functionalities (such as #76), refining the way that VAuto works would be important.

Specifically, these are desirable:

  • Functions can take VAuto as argument.
  • VAuto are actually stored as VAuto in constructs, not as a concrete default value.
  • VAuto are resolved to a concrete value later, whether when it's being converted to Pandoc AST, repr string, or an element.

sghng avatar Oct 22 '25 01:10 sghng

I don't understand how this library is falling short of your desires. It doesn't resolve auto to default values, does it? It passes VAuto values to pandoc or other libraries that use it. Currently I don't think pandoc does anything to resolve these (but probably the fields they are used in mostly don't matter for the degree of resolution pandoc is going for).

jgm avatar Oct 23 '25 09:10 jgm

@jgm I don't see any function accepting VAuto as an arg in the code base yet, so I'm not sure if it works.

I think resolving auto is not a stretch for pandoc.

#set text(fill: red)
#text()[Some text] // this is red, because it's implicitly
#text(fill: auto)[Some text] // in which the auto resolves to red

So it's relevant even for basic styling. This should make the implementation simpler?

sghng avatar Oct 28 '25 17:10 sghng