typst-community / glossarium

Glossarium is a simple typst glossary.
MIT License
41 stars 11 forks source link

A way to query glossary references separately to web links #68

Closed gerob311 closed 1 month ago

gerob311 commented 1 month ago

It's great that there's an example on how to style the links generated by this package.

#show link: set text(fill: blue)

However, I'd like to be able to style links to the glossary, differently to URLs. Do glossary links have a label on them that can be used to create a more specific show command? Something like

#show link.where(label: <a>): it => smallcaps(it)

Where <a> is a label attached to every glossary reference.

quachpas commented 1 month ago

Glossary links are just that, links to a label. I don't think it's possible to style links based on the destination, as it is a label. Text cannot be accessed on a label. A convoluted workaround would be to query the glossary heading, and check it against the location of the label. If the label is in the glossary, then style it. If you manage to write it, it would be great! Otherwise I'll take a look at this another time 👍 If you struggle, tag me or if I take too long don't hesitate to write this question and your thoughts on the forum https://forum.typst.app/ in the Questions category, with tag glossarium. Someone might take a stab at it, it doesn't sound too complicated. EDIT: the links have a label but not confident querying this label would help