diff options
| author | Andrew Voynov <37143421+Andrew15-5@users.noreply.github.com> | 2025-06-24 15:49:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-24 12:49:28 +0000 |
| commit | f162c371017f0d503cfae8738cbbf505b9f11173 (patch) | |
| tree | 64f7a886caecaa94690db2d6845c6d5476cf945a /crates/typst-library/src | |
| parent | 87c56865606e027f552a4dbc800c6851b0d0b821 (diff) | |
Improve equation reference example (#6481)
Diffstat (limited to 'crates/typst-library/src')
| -rw-r--r-- | crates/typst-library/src/model/reference.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/crates/typst-library/src/model/reference.rs b/crates/typst-library/src/model/reference.rs index f22d70b3..6fddc56c 100644 --- a/crates/typst-library/src/model/reference.rs +++ b/crates/typst-library/src/model/reference.rs @@ -91,16 +91,13 @@ use crate::text::TextElem; /// #show ref: it => { /// let eq = math.equation /// let el = it.element -/// if el != none and el.func() == eq { -/// // Override equation references. -/// link(el.location(),numbering( -/// el.numbering, -/// ..counter(eq).at(el.location()) -/// )) -/// } else { -/// // Other references as usual. -/// it -/// } +/// // Skip all other references. +/// if el == none or el.func() != eq { return it } +/// // Override equation references. +/// link(el.location(), numbering( +/// el.numbering, +/// ..counter(eq).at(el.location()) +/// )) /// } /// /// = Beginnings <beginning> |
