Repository navigation
Support text show rules that match their own output - #3327
Conversation
|
What will happen here (after the merge): #show "keyword": ```lang keyword```
keyword
`keyword`
```
expr const keyword number
```(I ran into this problem before, and it was solved with a couple of show rules and a word joiner char. It only must change normal non-raw text.) What if instead the show rule will multiply the number of initial applicable word? #show "keyword": `keyword keyword`
// or
#show "keyword": "keyword keyword"Do you have to use something like this or not: #show "keyword": it => it + " " + it
What is "non-text" exactly? There is no "text" type in Typst. You mean non-string show rules? |
|
Every text show rule will apply just once. Show rules still apply to raw text, that's a separate thing. If the show rule multiplies the word, it still happens just once, so it will go 1->2 but not 2->4. You do not have to use
There is a |
…relatório) Read-only no histórico real do vanilla (main, 4476 commits, 0.14.2). I7: a recursão auto-casante foi QUIS (typst#3327 'Support text show rules that match their own output', Laurenz). I8: a Revocation já está implementada (não é falha aberta). I9: o teto é limite de segurança genérico (família MAX_*_DEPTH), não hack de perf. Veredito: o tekt NÃO achou um bug — achou uma diferença de prioridade de design; α é melhoria condicional, não conserto. Refina o GEROU do P347b (feature QUIS, borda-de-identidade mecânica) e corrige o enquadramento. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…relatório) Read-only no histórico real do vanilla (main, 4476 commits, 0.14.2). I7: a recursão auto-casante foi QUIS (typst#3327 'Support text show rules that match their own output', Laurenz). I8: a Revocation já está implementada (não é falha aberta). I9: o teto é limite de segurança genérico (família MAX_*_DEPTH), não hack de perf. Veredito: o tekt NÃO achou um bug — achou uma diferença de prioridade de design; α é melhoria condicional, não conserto. Refina o GEROU do P347b (feature QUIS, borda-de-identidade mecânica) e corrige o enquadramento. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This allows things like
and
without running into show rule recursion problems.
Note that Typst will still yield show rule recursion errors for self-matching non-text rules that don't use
it(e.g.show list: it => list[a][b]). While this might seem bad at first glance, I think it is the correct choice. Revoking the list show rule for all content resulting from it would be wrong in the general case: The list might have contained nested lists, which then wouldn't be shown with the rule.With a lot of effort, it might be possible to distinguish between an original nested list and a list generated by the rule, but there are further problems: Showing a list as another list yields two lists on a semantical layer. This can lead to surprising query() results and will also result in accessibility problems down the road. So I think replacing an element with one that rematches the result is bad practice. All these problems don't exist for text, so it's fine here and it's also where the lack of this recursion protection hurts the most.
Fixes #229