feat(glossy): 0.1.2

This commit is contained in:
swaits committed 2024-12-10 20:44:44 +00:00
1 parent 347d44b5da
commit d30225f4e6
4 files changed
+143 -11

No files matched your search

+48 -2
View File
@@ -43,7 +43,7 @@ different goals:
### Import the package
```typst
#import "@preview/glossy:0.1.1": *
#import "@preview/glossy:0.1.2": *
```
@@ -86,6 +86,32 @@ Note that you could also load glossary entries from a data file using
[#json()](https://typst.app/docs/reference/data-loading/json/), or
[similar](https://typst.app/docs/reference/data-loading/).
For example, the above glossary could be in this YAML file:
```yaml
- key: html,
short: HTML,
long: Hypertext Markup Language,
description: A standard language for creating web pages,
group: Web
- key: css
short: CSS,
long: Cascading Style Sheets,
description: A stylesheet language used for describing the presentation of a document,
group: Web
- key: tps,
short: TPS,
long: test procedure specification
```
And then loaded during initialization as follows:
```typst
#show: init-glossary.with(yaml("glossary.yaml"))
```
### Using Glossary Terms in Your Document
Use glossary terms within your text using the `@reference` functionality in
@@ -142,7 +168,27 @@ the title and specify a theme if desired:
#glossary(title: "Web Development Glossary", theme: my-theme, groups: ("Web"))
```
### Themes
See more on theming below in "Glossary Themes."
### Customizing the Output
#### Term usage in documents
You can control how terms are displayed when using the `@term` reference syntax
in your document by passing a custom function to `init-glossary` in the
`show-term` parameter.
For example, if you wanted all terms to be italicized, you could do this:
```typst
#let emph-term(body) = { emph(body) }
#show: init-glossary.with(myGlossary, show-term: emph-term)
// remainder of document follows
```
#### Glossary Themes
Customize the appearance of the glossary using themes. Each theme defines how
sections, groups, and entries are displayed.