summaryrefslogtreecommitdiff
path: root/library/src/meta
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-20 16:08:16 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-20 16:11:37 +0100
commitf5f7df7247ae29800e0290774a50942e2485beea (patch)
tree57253ba51efdae3ac8e4eea722428924625b514c /library/src/meta
parentb8ffd3ad3dcaebddbc674e03494e0d818b21fa51 (diff)
Documentation
Diffstat (limited to 'library/src/meta')
-rw-r--r--library/src/meta/document.rs5
-rw-r--r--library/src/meta/link.rs13
-rw-r--r--library/src/meta/outline.rs25
-rw-r--r--library/src/meta/reference.rs9
4 files changed, 28 insertions, 24 deletions
diff --git a/library/src/meta/document.rs b/library/src/meta/document.rs
index c5d4e050..32e944dc 100644
--- a/library/src/meta/document.rs
+++ b/library/src/meta/document.rs
@@ -1,6 +1,7 @@
use crate::layout::{LayoutRoot, PageNode};
use crate::prelude::*;
+/// # Document
/// The root element of a document and its metadata.
///
/// All documents are automatically wrapped in a `document` element. The main
@@ -10,8 +11,8 @@ use crate::prelude::*;
/// The metadata set with this function is not rendered within the document.
/// Instead, it is embedded in the compiled PDF file.
///
-/// # Tags
-/// - meta
+/// ## Category
+/// meta
#[func]
#[capable(LayoutRoot)]
#[derive(Hash)]
diff --git a/library/src/meta/link.rs b/library/src/meta/link.rs
index 3b816083..501ccddb 100644
--- a/library/src/meta/link.rs
+++ b/library/src/meta/link.rs
@@ -1,12 +1,13 @@
use crate::prelude::*;
use crate::text::TextNode;
+/// # Link
/// Link to a URL or another location in the document.
///
/// The link function makes its positional `body` argument clickable and links
/// it to the destination specified by the `dest` argument.
///
-/// # Example
+/// ## Example
/// ```
/// #show link: underline
///
@@ -16,10 +17,10 @@ use crate::text::TextNode;
/// ]
/// ```
///
-/// # Parameters
+/// ## Parameters
/// - dest: Destination (positional, required)
/// The destination the link points to.
-///
+///
/// - To link to web pages, `dest` should be a valid URL string. If the URL is
/// in the `mailto:` or `tel:` scheme and the `body` parameter is omitted,
/// the email address or phone number will be the link's body, without the
@@ -30,7 +31,7 @@ use crate::text::TextNode;
/// coordinates of type `length`. Pages are counted from one, and the
/// coordinates are relative to the page's top left corner.
///
-/// # Example
+/// ### Example
/// ```
/// #link("mailto:hello@typst.app") \
/// #link((page: 1, x: 0pt, y: 0pt))[
@@ -43,8 +44,8 @@ use crate::text::TextNode;
/// The content that should become a link. If `dest` is an URL string, the
/// parameter can be omitted. In this case, the URL will be shown as the link.
///
-/// # Tags
-/// - meta
+/// ## Category
+/// meta
#[func]
#[capable(Show, Finalize)]
#[derive(Debug, Hash)]
diff --git a/library/src/meta/outline.rs b/library/src/meta/outline.rs
index 47453526..da73ad5a 100644
--- a/library/src/meta/outline.rs
+++ b/library/src/meta/outline.rs
@@ -3,13 +3,14 @@ use crate::layout::{BlockNode, HNode, HideNode, RepeatNode, Spacing};
use crate::prelude::*;
use crate::text::{LinebreakNode, SpaceNode, TextNode};
-/// Generate a section outline / table of contents.
+/// # Outline
+/// A section outline / table of contents.
///
-/// This function generates a list of all headings in the
-/// document, up to a given depth. The [@heading] numbering will be reproduced
-/// within the outline.
+/// This function generates a list of all headings in the document, up to a
+/// given depth. The [heading](@heading) numbering will be reproduced within the
+/// outline.
///
-/// # Example
+/// ## Example
/// ```
/// #outline()
///
@@ -20,8 +21,8 @@ use crate::text::{LinebreakNode, SpaceNode, TextNode};
/// #lorem(10)
/// ```
///
-/// # Tags
-/// - meta
+/// ## Category
+/// meta
#[func]
#[capable(Prepare, Show)]
#[derive(Debug, Hash)]
@@ -31,8 +32,8 @@ pub struct OutlineNode;
impl OutlineNode {
/// The title of the outline.
///
- /// - When set to `{auto}`, an appropriate title for the [@text] language will
- /// be used. This is the default.
+ /// - When set to `{auto}`, an appropriate title for the [text](@text)
+ /// language will be used. This is the default.
/// - When set to `{none}`, the outline will not have a title.
/// - A custom title can be set by passing content.
#[property(referenced)]
@@ -44,7 +45,7 @@ impl OutlineNode {
/// Whether to indent the subheadings to align the start of their numbering
/// with the title of their parents. This will only have an effect if a
- /// [@heading] numbering is set.
+ /// [heading](@heading) numbering is set.
///
/// # Example
/// ```
@@ -114,7 +115,7 @@ impl Show for OutlineNode {
});
seq.push(
- HeadingNode { body, level: NonZeroUsize::new(1).unwrap() }
+ HeadingNode { title: body, level: NonZeroUsize::new(1).unwrap() }
.pack()
.styled(HeadingNode::NUMBERING, None)
.styled(HeadingNode::OUTLINED, false),
@@ -175,7 +176,7 @@ impl Show for OutlineNode {
};
// Add the numbering and section name.
- let start = numbering + heading.body.clone();
+ let start = numbering + heading.title.clone();
seq.push(start.linked(Destination::Internal(loc)));
// Add filler symbols between the section name and page number.
diff --git a/library/src/meta/reference.rs b/library/src/meta/reference.rs
index 1a4b22e4..2165ed97 100644
--- a/library/src/meta/reference.rs
+++ b/library/src/meta/reference.rs
@@ -1,6 +1,7 @@
use crate::prelude::*;
use crate::text::TextNode;
+/// # Reference
/// A reference to a label.
///
/// *Note: This function is currently unimplemented.*
@@ -10,17 +11,17 @@ use crate::text::TextNode;
/// 1" for a reference to the first heading's label. The references are also
/// links to the respective labels.
///
-/// # 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]`).
///
-/// # Parameters
+/// ## Parameters
/// - target: Label (positional, required)
/// The label that should be referenced.
///
-/// # Tags
-/// - meta
+/// ## Category
+/// meta
#[func]
#[capable(Show)]
#[derive(Debug, Hash)]