summaryrefslogtreecommitdiff
path: root/library/src/meta
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-17 14:38:03 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-17 14:38:03 +0200
commit42afa410ae561eb5b267080d088bca529a5d0b54 (patch)
treebdea7348daef7409490ba542f9bdec5d52732d03 /library/src/meta
parent8971588486b6ffa9269344b4bda71de86af9d908 (diff)
Better documentation outlines
Diffstat (limited to 'library/src/meta')
-rw-r--r--library/src/meta/counter.rs14
-rw-r--r--library/src/meta/figure.rs4
-rw-r--r--library/src/meta/heading.rs4
-rw-r--r--library/src/meta/link.rs4
-rw-r--r--library/src/meta/numbering.rs2
-rw-r--r--library/src/meta/outline.rs4
-rw-r--r--library/src/meta/query.rs6
-rw-r--r--library/src/meta/reference.rs6
-rw-r--r--library/src/meta/state.rs8
9 files changed, 26 insertions, 26 deletions
diff --git a/library/src/meta/counter.rs b/library/src/meta/counter.rs
index 5c23c536..0e41a826 100644
--- a/library/src/meta/counter.rs
+++ b/library/src/meta/counter.rs
@@ -16,7 +16,7 @@ use crate::prelude::*;
/// headings, figures, and more. Moreover, you can define custom counters for
/// other things you want to count.
///
-/// ## Displaying a counter
+/// ## Displaying a counter { #displaying }
/// To display the current value of the heading counter, you call the `counter`
/// function with the `key` set to `heading` and then call the `display` method
/// on the counter. To see any output, you also have to enable heading
@@ -40,7 +40,7 @@ use crate::prelude::*;
/// #counter(heading).display("I")
/// ```
///
-/// ## Modifying a counter
+/// ## Modifying a counter { #modifying }
/// To modify a counter, you can use the `step` and `update` methods:
///
/// - The `step` method increases the value of the counter by one. Because
@@ -75,7 +75,7 @@ use crate::prelude::*;
/// Still at #counter(heading).display().
/// ```
///
-/// ## Custom counters
+/// ## Custom counters { #custom-counters }
/// To define your own counter, call the `counter` function with a string as a
/// key. This key identifies the counter globally.
///
@@ -88,7 +88,7 @@ use crate::prelude::*;
/// #mine.display() \
/// ```
///
-/// ## How to step
+/// ## How to step { #how-to-step }
/// When you define and use a custom counter, in general, you should first step
/// the counter and then display it. This way, the stepping behaviour of a
/// counter can depend on the element it is stepped for. If you were writing a
@@ -117,7 +117,7 @@ use crate::prelude::*;
/// they always start at zero. This way, they are at one for the first display
/// (which happens after the first step).
///
-/// ## Page counter
+/// ## Page counter { #page-counter }
/// The page counter is special. It is automatically stepped at each pagebreak.
/// But like other counters, you can also step it manually. For example, you
/// could have Roman page numbers for your preface, then switch to Arabic page
@@ -144,7 +144,7 @@ use crate::prelude::*;
/// Arabic numbers.
/// ```
///
-/// ## Time travel
+/// ## Time travel { #time-travel }
/// Counters can travel through time! You can find out the final value of the
/// counter before it is reached and even determine what the value was at any
/// particular location in the document.
@@ -195,7 +195,7 @@ use crate::prelude::*;
/// which one doesn't matter. After the heading follow two calls to `step()`,
/// so the final value is `{(6,)}`.
///
-/// ## Other kinds of state
+/// ## Other kinds of state { #other-state }
/// The `counter` function is closely related to [state]($func/state) function.
/// Read its documentation for more details on state management in Typst and
/// why it doesn't just use normal variables for counters.
diff --git a/library/src/meta/figure.rs b/library/src/meta/figure.rs
index fe492238..f23cbacc 100644
--- a/library/src/meta/figure.rs
+++ b/library/src/meta/figure.rs
@@ -15,7 +15,7 @@ use crate::visualize::ImageElem;
/// For example, figures containing images will be numbered separately from
/// figures containing tables.
///
-/// ## Examples
+/// ## Examples { #examples }
/// The example below shows a basic figure with an image:
/// ```example
/// @glacier shows a glacier. Glaciers
@@ -45,7 +45,7 @@ use crate::visualize::ImageElem;
/// This behaviour can be overridden by explicitly specifying the figure's
/// `kind`. All figures of the same kind share a common counter.
///
-/// ## Modifying the appearance
+/// ## Modifying the appearance { #modifying-appearance }
/// You can completely customize the look of your figures with a [show
/// rule]($styling/#show-rules). In the example below, we show the figure's
/// caption above its body and display its supplement and counter after the
diff --git a/library/src/meta/heading.rs b/library/src/meta/heading.rs
index 01804edc..a5fa7441 100644
--- a/library/src/meta/heading.rs
+++ b/library/src/meta/heading.rs
@@ -24,7 +24,7 @@ use crate::text::{SpaceElem, TextElem, TextSize};
/// headings from this outline, you can set the `outlined` parameter to
/// `{false}`.
///
-/// ## Example
+/// ## Example { #example }
/// ```example
/// #set heading(numbering: "1.a)")
///
@@ -35,7 +35,7 @@ use crate::text::{SpaceElem, TextElem, TextSize};
/// To start, ...
/// ```
///
-/// ## Syntax
+/// ## Syntax { #syntax }
/// Headings have dedicated syntax: They can be created by starting a line with
/// one or multiple equals signs, followed by a space. The number of equals
/// signs determines the heading's logical nesting depth.
diff --git a/library/src/meta/link.rs b/library/src/meta/link.rs
index aaf2476a..93b9999d 100644
--- a/library/src/meta/link.rs
+++ b/library/src/meta/link.rs
@@ -8,7 +8,7 @@ use crate::text::{Hyphenate, TextElem};
/// are not styled any different from normal text. However, you can easily apply
/// a style of your choice with a show rule.
///
-/// ## Example
+/// ## Example { #example }
/// ```example
/// #show link: underline
///
@@ -20,7 +20,7 @@ use crate::text::{Hyphenate, TextElem};
/// ]
/// ```
///
-/// ## Syntax
+/// ## Syntax { #syntax }
/// This function also has dedicated syntax: Text that starts with `http://` or
/// `https://` is automatically turned into a link.
///
diff --git a/library/src/meta/numbering.rs b/library/src/meta/numbering.rs
index dc3ae987..7ba27aaa 100644
--- a/library/src/meta/numbering.rs
+++ b/library/src/meta/numbering.rs
@@ -16,7 +16,7 @@ use crate::text::Case;
/// number is substituted, their prefixes, and one suffix. The prefixes and the
/// suffix are repeated as-is.
///
-/// ## Example
+/// ## Example { #example }
/// ```example
/// #numbering("1.1)", 1, 2, 3) \
/// #numbering("1.a.i", 1, 2) \
diff --git a/library/src/meta/outline.rs b/library/src/meta/outline.rs
index 8e1bb723..2c51539d 100644
--- a/library/src/meta/outline.rs
+++ b/library/src/meta/outline.rs
@@ -16,7 +16,7 @@ use crate::text::{LinebreakElem, SpaceElem, TextElem};
/// be displayed in the outline alongside its title or caption. By default this
/// generates a table of contents.
///
-/// ## Example
+/// ## Example { #example }
/// ```example
/// #outline()
///
@@ -27,7 +27,7 @@ use crate::text::{LinebreakElem, SpaceElem, TextElem};
/// #lorem(10)
/// ```
///
-/// ## Alternative outlines
+/// ## Alternative outlines { #alternative-outlines }
/// By setting the `target` parameter, the outline can be used to generate a
/// list of other kinds of elements than headings. In the example below, we list
/// all figures containing images by setting `target` to `{figure.where(kind:
diff --git a/library/src/meta/query.rs b/library/src/meta/query.rs
index 4db658d7..ca4304b5 100644
--- a/library/src/meta/query.rs
+++ b/library/src/meta/query.rs
@@ -10,7 +10,7 @@ use crate::prelude::*;
/// find all elements, just the ones before that location, or just the ones
/// after it.
///
-/// ## Finding elements
+/// ## Finding elements { #finding-elements }
/// In the example below, we create a custom page header that displays the text
/// "Typst Academy" in small capitals and the current section title. On the
/// first page, the section title is omitted because the header is before the
@@ -62,7 +62,7 @@ use crate::prelude::*;
/// #lorem(15)
/// ```
///
-/// ## A word of caution
+/// ## A word of caution { #caution }
/// To resolve all your queries, Typst evaluates and layouts parts of the
/// document multiple times. However, there is no guarantee that your queries
/// can actually be completely resolved. If you aren't careful a query can
@@ -89,7 +89,7 @@ use crate::prelude::*;
/// })
/// ```
///
-/// ## Migration Hints
+/// ## Migration Hints { #migration-hints }
/// The `before` and `after` arguments have been removed in version 0.3.0. You
/// can now use flexible selector combinator methods instead. For example,
/// `query(heading, before: loc)` becomes `query(heading.before(loc), loc)`.
diff --git a/library/src/meta/reference.rs b/library/src/meta/reference.rs
index e4b6bbec..1f1f2b23 100644
--- a/library/src/meta/reference.rs
+++ b/library/src/meta/reference.rs
@@ -19,7 +19,7 @@ use crate::text::TextElem;
/// If you just want to link to a labelled element and not get an automatic
/// textual reference, consider using the [`link`]($func/link) function instead.
///
-/// ## Example
+/// ## Example { #example }
/// ```example
/// #set heading(numbering: "1.")
/// #set math.equation(numbering: "(1)")
@@ -43,7 +43,7 @@ use crate::text::TextElem;
/// #bibliography("works.bib")
/// ```
///
-/// ## Syntax
+/// ## Syntax { #syntax }
/// This function also has dedicated syntax: A reference to a label can be
/// created by typing an `@` followed by the name of the label (e.g.
/// `[= Introduction <intro>]` can be referenced by typing `[@intro]`).
@@ -51,7 +51,7 @@ use crate::text::TextElem;
/// To customize the supplement, add content in square brackets after the
/// reference: `[@intro[Chapter]]`.
///
-/// ## Customization
+/// ## Customization { #customization }
/// If you write a show rule for references, you can access the referenced
/// element through the `element` field of the reference. The `element` may
/// be `{none}` even if it exists if Typst hasn't discovered it yet, so you
diff --git a/library/src/meta/state.rs b/library/src/meta/state.rs
index 33c3b595..284daf54 100644
--- a/library/src/meta/state.rs
+++ b/library/src/meta/state.rs
@@ -29,7 +29,7 @@ use crate::prelude::*;
/// #compute("x - 5")
/// ```
///
-/// ## State and document markup
+/// ## State and document markup { #state-and-markup }
/// Why does it do that? Because, in general, this kind of computation with side
/// effects is problematic in document markup and Typst is upfront about that.
/// For the results to make sense, the computation must proceed in the same
@@ -60,7 +60,7 @@ use crate::prelude::*;
/// `template` function and only then sees the `Outline`. Just counting up would
/// number the `Introduction` with `1` and the `Outline` with `2`.
///
-/// ## Managing state in Typst
+/// ## Managing state in Typst { #state-in-typst }
/// So what do we do instead? We use Typst's state management system. Calling
/// the `state` function with an identifying string key and an optional initial
/// value gives you a state value which exposes a few methods. The two most
@@ -123,7 +123,7 @@ use crate::prelude::*;
/// what you want! A good example are heading counters, which is why Typst's
/// [counting system]($func/counter) is very similar to its state system.
///
-/// ## Time Travel
+/// ## Time Travel { #time-travel }
/// By using Typst's state management system you also get time travel
/// capabilities! By combining the state system with [`locate`]($func/locate)
/// and [`query`]($func/query), we can find out what the value of the state will
@@ -155,7 +155,7 @@ use crate::prelude::*;
/// #compute("x - 5")
/// ```
///
-/// ## A word of caution
+/// ## A word of caution { #caution }
/// To resolve the values of all states, Typst evaluates parts of your code
/// multiple times. However, there is no guarantee that your state manipulation
/// can actually be completely resolved.