Miscellaneous minor docs improvements (#6651)

Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
Y.D.X. 2025-07-28 17:39:13 +08:00 committed by GitHub
parent a4d4dfb1b6
commit d446cde4fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 56 additions and 3 deletions

View File

@ -412,9 +412,11 @@ impl Counter {
/// - If it is a string, creates a custom counter that is only affected
/// by manual updates,
/// - If it is the [`page`] function, counts through pages,
/// - If it is a [selector], counts through elements that matches with the
/// - If it is a [selector], counts through elements that match the
/// selector. For example,
/// - provide an element function: counts elements of that type,
/// - provide a [`where`]($function.where) selector:
/// counts a type of element with specific fields,
/// - provide a [`{<label>}`]($label): counts elements with that label.
key: CounterKey,
) -> Counter {

View File

@ -397,6 +397,15 @@ impl LocalName for PageElem {
/// == Compound Theory
/// In 1984, the first ...
/// ```
///
/// Even without manual page breaks, content will be automatically paginated
/// based on the configured page size. You can set [the page height]($page.height)
/// to `{auto}` to let the page grow dynamically until a manual page break
/// occurs.
///
/// Pagination tries to avoid single lines of text at the top or bottom of a
/// page (these are called _widows_ and _orphans_). You can adjust the
/// [`text.costs`]($text.costs) parameter to disable this behavior.
#[elem(title = "Page Break")]
pub struct PagebreakElem {
/// If `{true}`, the page break is skipped if the current page is already

View File

@ -189,6 +189,39 @@ pub struct FigureElem {
/// supplement: [Atom],
/// )
/// ```
///
/// If you want to modify a counter to skip a number or reset the counter,
/// you can access the [counter] of each kind of figure with a
/// [`where`]($function.where) selector:
///
/// - For [tables]($table): `{counter(figure.where(kind: table))}`
/// - For [images]($image): `{counter(figure.where(kind: image))}`
/// - For a custom kind: `{counter(figure.where(kind: kind))}`
///
/// ```example
/// #figure(
/// table(columns: 2, $n$, $1$),
/// caption: [The first table.],
/// )
///
/// #counter(
/// figure.where(kind: table)
/// ).update(41)
///
/// #figure(
/// table(columns: 2, $n$, $42$),
/// caption: [The 42nd table],
/// )
///
/// #figure(
/// rect[Image],
/// caption: [Does not affect images],
/// )
/// ```
///
/// To conveniently use the correct counter in a show rule, you can access
/// the `counter` field. There is an example of this in the documentation
/// [of the `figure.caption` element's `body` field]($figure.caption.body).
pub kind: Smart<FigureKind>,
/// The figure's supplement.
@ -228,8 +261,8 @@ pub struct FigureElem {
/// Convenience field to get access to the counter for this figure.
///
/// The counter only depends on the `kind`:
/// - For (tables)[@table]: `{counter(figure.where(kind: table))}`
/// - For (images)[@image]: `{counter(figure.where(kind: image))}`
/// - For [tables]($table): `{counter(figure.where(kind: table))}`
/// - For [images]($image): `{counter(figure.where(kind: image))}`
/// - For a custom kind: `{counter(figure.where(kind: kind))}`
///
/// These are the counters you'll need to modify if you want to skip a

View File

@ -411,6 +411,9 @@ pub struct TextElem {
/// = Einleitung
/// In diesem Dokument, ...
/// ```
///
/// The language code is case-insensitive, and will be lowercased when
/// accessed through [context]($context).
#[default(Lang::ENGLISH)]
#[ghost]
pub lang: Lang,
@ -418,6 +421,9 @@ pub struct TextElem {
/// An [ISO 3166-1 alpha-2 region code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
///
/// This lets the text processing pipeline make more informed choices.
///
/// The region code is case-insensitive, and will be uppercased when
/// accessed through [context]($context).
#[ghost]
pub region: Option<Region>,

View File

@ -3,3 +3,6 @@ with a normal keyboard. Alternatively, you can also always directly enter
Unicode symbols into your text and formulas. In addition to the symbols listed
below, math mode defines `dif` and `Dif`. These are not normal symbol values
because they also affect spacing and font style.
You can define custom symbols with the constructor function of the
[symbol]($symbol) type.