Fix counting when glossary item is referenced inside of outline #169
+83
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all: thank you very much for providing and maintaining this awesome library! I hope I can help improve it a little bit.
There is one thing that trips me up with every document that I write, which includes an outline/index of figures/... at the start.
When I want to reference a glossary item in the elements that are matched by the
outlinestargetquery, the fact that Typst renders theoutlinefirst means that the internal counting thatglossariumdoes is off.For example, if I have the following stupid example (simplified)...
..the problem arises that the long version of "B2B" is not used when the term is actually used for the first time. Also it feels bad to have a mismatch between the caption/heading/... displayed in the outline and the actual caption/heading/....
I have also added another example which demonstrates the before/after
The fix I provide feels a bit hacky, though it seems to work for the things I have tested (see also the example).
If anyone has a better idea, I am welcome to change the implementation and discuss more -- feel free to also create an issue.
Cheers!