Skip to content

Commit e106a06

Browse files
committed
Document the use of linguify-raw as a way to handle outlines. Fixes #25 (again)
1 parent 395432a commit e106a06

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

docs/docs.typ

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,25 @@ If you use multiple databases for different parts of your document, and also use
109109

110110
See the #ref-fn("database-at()") function for more details.
111111

112+
Alternatively, you can use #ref-fn("linguify-raw()") to manually provide context to #l. By doing so, you can control that #l is using the context from outside the heading, which means the same context in the heading and the outline:
113+
114+
```typ
115+
// wrong: `linguify` provides its own context inside the heading
116+
// (unless you use `database-at` as shown above)
117+
= #linguify("...")
118+
119+
// correct: use externally provided context that refers to outside the heading
120+
#context [= #linguify-raw("...")]
121+
```
122+
123+
This will make _all_ context match between heading and outline (e.g. also the current language), whereas using #ref-fn("database-at()") only affects the database being used.
124+
112125
== Information for package authors.<4pck>
113126

114127
As the database is stored in a typst state, it can be overwritten. This leads to the following problem. If you use #l inside your package and use the #ref-fn("set-database()") function it will probably work like you expect. But if a user imports your package and uses #l for their own document as well, he will overwrite the your database by using #ref-fn("set-database()"). Therefore it is recommend to use the `from` argument in the #ref-fn("linguify()") function to specify your database directly.
115128

116-
Example:
129+
#block(sticky: true)[Example:]
130+
117131
```typc
118132
// Load data
119133
#let lang-data = toml("lang.toml")

manual.pdf

1.89 KB
Binary file not shown.

0 commit comments

Comments
 (0)