From f5f7df7247ae29800e0290774a50942e2485beea Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 20 Dec 2022 16:08:16 +0100 Subject: Documentation --- library/src/text/deco.rs | 7 ++++--- library/src/text/misc.rs | 47 ++++++++++++++++++++++++++-------------------- library/src/text/mod.rs | 7 ++++--- library/src/text/quotes.rs | 7 ++++--- library/src/text/raw.rs | 7 ++++--- library/src/text/shift.rs | 7 ++++--- library/src/text/symbol.rs | 7 ++++--- 7 files changed, 51 insertions(+), 38 deletions(-) (limited to 'library/src/text') diff --git a/library/src/text/deco.rs b/library/src/text/deco.rs index d725697e..81157bfb 100644 --- a/library/src/text/deco.rs +++ b/library/src/text/deco.rs @@ -4,14 +4,15 @@ use ttf_parser::{GlyphId, OutlineBuilder}; use super::TextNode; use crate::prelude::*; +/// # Underline /// Typeset underline, stricken-through or overlined text. /// -/// # Parameters +/// ## Parameters /// - body: Content (positional, required) /// The content to decorate. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Show)] #[derive(Debug, Hash)] diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs index 20be156a..df40e52d 100644 --- a/library/src/text/misc.rs +++ b/library/src/text/misc.rs @@ -1,10 +1,11 @@ use super::TextNode; use crate::prelude::*; +/// # Space /// A text space. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Unlabellable, Behave)] #[derive(Debug, Hash)] @@ -25,14 +26,15 @@ impl Behave for SpaceNode { } } +/// # Line Break /// A line break. /// -/// # Parameters +/// ## Parameters /// - justify: bool (named) /// Whether to justify the line before the break. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Behave)] #[derive(Debug, Hash)] @@ -54,14 +56,15 @@ impl Behave for LinebreakNode { } } +/// # Strong Emphasis /// Strongly emphasizes content by increasing the font weight. /// -/// # Parameters +/// ## Parameters /// - body: Content (positional, required) /// The content to strongly emphasize. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Show)] #[derive(Debug, Hash)] @@ -107,14 +110,15 @@ impl Fold for Delta { } } +/// # Emphasis /// Emphasizes content by flipping the italicness. /// -/// # Parameters +/// ## Parameters /// - body: Content (positional, required) /// The content to emphasize. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Show)] #[derive(Debug, Hash)] @@ -152,27 +156,29 @@ impl Fold for Toggle { } } +/// # Lowercase /// Convert text or content to lowercase. /// -/// # Parameters +/// ## Parameters /// - text: ToCase (positional, required) /// The text to convert to lowercase. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] pub fn lower(args: &mut Args) -> SourceResult { case(Case::Lower, args) } +/// # Uppercase /// Convert text or content to uppercase. /// -/// # Parameters +/// ## Parameters /// - text: ToCase (positional, required) /// The text to convert to uppercase. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] pub fn upper(args: &mut Args) -> SourceResult { case(Case::Upper, args) @@ -216,14 +222,15 @@ impl Case { } } +/// # Small Capitals /// Display text in small capitals. /// -/// # Parameters +/// ## Parameters /// - text: Content (positional, required) /// The text to display to small capitals. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] pub fn smallcaps(args: &mut Args) -> SourceResult { let body: Content = args.expect("content")?; diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs index 315de95d..e962685d 100644 --- a/library/src/text/mod.rs +++ b/library/src/text/mod.rs @@ -25,17 +25,18 @@ use typst::util::EcoString; use crate::layout::ParNode; use crate::prelude::*; +/// # Text /// Stylable text. /// -/// # Parameters +/// ## Parameters /// - family: EcoString (positional, variadic, settable) /// A prioritized sequence of font families. /// /// - body: Content (positional, required) /// Content in which all text is styled according to the other arguments. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable] #[derive(Clone, Hash)] diff --git a/library/src/text/quotes.rs b/library/src/text/quotes.rs index 4f65c7fd..5965df56 100644 --- a/library/src/text/quotes.rs +++ b/library/src/text/quotes.rs @@ -2,14 +2,15 @@ use typst::syntax::is_newline; use crate::prelude::*; +/// # Smart Quote /// A smart quote. /// -/// # Parameters +/// ## Parameters /// - double: bool (named) /// Whether to produce a smart double quote. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable] #[derive(Debug, Hash)] diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs index 55c29298..240f82e8 100644 --- a/library/src/text/raw.rs +++ b/library/src/text/raw.rs @@ -6,17 +6,18 @@ use super::{FontFamily, Hyphenate, LinebreakNode, TextNode}; use crate::layout::BlockNode; use crate::prelude::*; +/// # Raw Text /// Raw text with optional syntax highlighting. /// -/// # Parameters +/// ## Parameters /// - text: EcoString (positional, required) /// The raw text. /// /// - block: bool (named) /// Whether the raw text is displayed as a separate block. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Show)] #[derive(Debug, Hash)] diff --git a/library/src/text/shift.rs b/library/src/text/shift.rs index 969dce68..5ea3b5ea 100644 --- a/library/src/text/shift.rs +++ b/library/src/text/shift.rs @@ -4,6 +4,7 @@ use typst::util::EcoString; use super::{variant, SpaceNode, TextNode, TextSize}; use crate::prelude::*; +/// # Subscript /// Sub- or superscript text. /// /// The text is rendered smaller and its baseline is raised/lowered. To provide @@ -11,12 +12,12 @@ use crate::prelude::*; /// superscript codepoints. If that fails, we fall back to rendering shrunk /// normal letters in a raised way. /// -/// # Parameters +/// ## Parameters /// - body: Content (positional, required) /// The text to display in sub- or superscript. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Show)] #[derive(Debug, Hash)] diff --git a/library/src/text/symbol.rs b/library/src/text/symbol.rs index ccf1a55e..ec2653df 100644 --- a/library/src/text/symbol.rs +++ b/library/src/text/symbol.rs @@ -1,14 +1,15 @@ use crate::prelude::*; use crate::text::TextNode; +/// # Symbol /// A symbol identified by symmie notation. /// -/// # Parameters +/// ## Parameters /// - notation: EcoString (positional, required) /// The symbols symmie notation. /// -/// # Tags -/// - text +/// ## Category +/// text #[func] #[capable(Show)] #[derive(Debug, Hash)] -- cgit v1.2.3