mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Small documentation fixes 🧾
This commit is contained in:
parent
91d14d2a22
commit
54e0da59e3
@ -20,9 +20,11 @@ pub struct RgbaColor {
|
||||
pub b: u8,
|
||||
/// Alpha channel.
|
||||
pub a: u8,
|
||||
/// This is true if this value was provided as a fail-over by the parser
|
||||
/// because the user-defined value was invalid. This color may be
|
||||
/// overwritten if this property is true.
|
||||
/// Whether the color was provided as a fail-over by the parser because the
|
||||
/// user-defined value was invalid.
|
||||
///
|
||||
/// If this is true, the color may be replaced with any color deemed
|
||||
/// approriate at the use-site.
|
||||
pub healed: bool,
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ impl Display for Level {
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct a diagnostic with `Error` level.
|
||||
/// Construct a diagnostic with [`Error`] level.
|
||||
///
|
||||
/// ```
|
||||
/// # use typstc::error;
|
||||
@ -59,6 +59,8 @@ impl Display for Level {
|
||||
/// // Create an error and directly add it to existing feedback.
|
||||
/// error!(@feedback, span, "oh no!");
|
||||
/// ```
|
||||
///
|
||||
/// [`Error`]: diagnostic/enum.Level.html#variant.Error
|
||||
#[macro_export]
|
||||
macro_rules! error {
|
||||
($($tts:tt)*) => {
|
||||
@ -66,10 +68,12 @@ macro_rules! error {
|
||||
};
|
||||
}
|
||||
|
||||
/// Construct a diagnostic with `Warning` level.
|
||||
/// Construct a diagnostic with [`Warning`] level.
|
||||
///
|
||||
/// This works exactly like `error!`. See its documentation for more
|
||||
/// information.
|
||||
///
|
||||
/// [`Warning`]: diagnostic/enum.Level.html#variant.Warning
|
||||
#[macro_export]
|
||||
macro_rules! warning {
|
||||
($($tts:tt)*) => {
|
||||
|
@ -31,7 +31,7 @@ pub enum Value {
|
||||
Length(f64),
|
||||
/// A relative value: `50%`.
|
||||
///
|
||||
/// Note: `50%` is represented as `0.5` here, but as `50.0` in the
|
||||
/// _Note_: `50%` is represented as `0.5` here, but as `50.0` in the
|
||||
/// corresponding [literal].
|
||||
///
|
||||
/// [literal]: ../syntax/ast/enum.Lit.html#variant.Percent
|
||||
|
@ -21,8 +21,6 @@
|
||||
//! [_PDF_]: export/pdf/index.html
|
||||
//! [`MultiLayout`]: layout/type.MultiLayout.html
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
#[macro_use]
|
||||
pub mod diagnostic;
|
||||
|
||||
@ -122,8 +120,7 @@ impl Typesetter {
|
||||
}
|
||||
|
||||
/// A dynamic future type which allows recursive invocation of async functions
|
||||
/// when used as the return type. This is also how the async trait functions
|
||||
/// work internally.
|
||||
/// when used as the return type.
|
||||
pub type DynFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
|
||||
|
||||
/// The result of some pass: Some output `T` and feedback data.
|
||||
|
@ -1,10 +0,0 @@
|
||||
/// Unwrap the option if it is `Some(T)` or evaluate `$or` if it is `None`.
|
||||
#[allow(unused)]
|
||||
macro_rules! try_or {
|
||||
($option:expr, $or:expr $(,)?) => {
|
||||
match $option {
|
||||
Some(v) => v,
|
||||
None => $or,
|
||||
}
|
||||
};
|
||||
}
|
@ -366,7 +366,7 @@ fn test_parse_colon_starting_func_args() {
|
||||
e!("[val/🌎:$]" => s(4, 4, "expected colon"));
|
||||
|
||||
// String in invalid header without colon still parsed as string
|
||||
// Note: No "expected quote" error because not even the string was
|
||||
// _Note_: No "expected quote" error because not even the string was
|
||||
// expected.
|
||||
e!("[val/\"]" => s(4, 4, "expected colon"),
|
||||
s(7, 7, "expected closing bracket"));
|
||||
|
@ -1,9 +1,11 @@
|
||||
//! A prelude for building custom functions.
|
||||
|
||||
#[doc(no_inline)]
|
||||
pub use crate::eval::{Dict, DictValue, Value};
|
||||
pub use crate::layout::primitive::*;
|
||||
#[doc(no_inline)]
|
||||
pub use crate::layout::{layout, Command, Commands, LayoutContext};
|
||||
pub use crate::style::*;
|
||||
#[doc(no_inline)]
|
||||
pub use crate::syntax::{Span, Spanned, SynTree};
|
||||
pub use crate::{Feedback, Pass};
|
||||
|
||||
|
@ -22,7 +22,7 @@ pub enum Lit {
|
||||
Length(Length),
|
||||
/// A percent literal: `50%`.
|
||||
///
|
||||
/// Note: `50%` is represented as `50.0` here, but as `0.5` in the
|
||||
/// _Note_: `50%` is represented as `50.0` here, but as `0.5` in the
|
||||
/// corresponding [value].
|
||||
///
|
||||
/// [value]: ../../eval/enum.Value.html#variant.Relative
|
||||
|
@ -83,7 +83,7 @@ impl<T> Spanned<T> {
|
||||
}
|
||||
|
||||
impl<T> Spanned<Option<T>> {
|
||||
/// Swap the spanned and option.
|
||||
/// Swap the spanned and the option.
|
||||
pub fn transpose(self) -> Option<Spanned<T>> {
|
||||
let Spanned { v, span } = self;
|
||||
v.map(|v| v.span_with(span))
|
||||
|
@ -75,7 +75,7 @@ pub enum Token<'s> {
|
||||
Length(Length),
|
||||
/// A percentage: `50%`.
|
||||
///
|
||||
/// Note: `50%` is represented as `50.0` here, as in the corresponding
|
||||
/// _Note_: `50%` is represented as `50.0` here, as in the corresponding
|
||||
/// [literal].
|
||||
///
|
||||
/// [literal]: ../ast/enum.Lit.html#variant.Percent
|
||||
|
Loading…
x
Reference in New Issue
Block a user