diff --git a/src/color.rs b/src/color.rs index 119192fed..5944b7c00 100644 --- a/src/color.rs +++ b/src/color.rs @@ -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, } diff --git a/src/diagnostic.rs b/src/diagnostic.rs index 2548e1d5b..8d56f4011 100644 --- a/src/diagnostic.rs +++ b/src/diagnostic.rs @@ -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)*) => { diff --git a/src/eval/value.rs b/src/eval/value.rs index 85ac2367e..f6c1fcd7f 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -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 diff --git a/src/lib.rs b/src/lib.rs index 3be978731..c47f7f513 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 + 'a>>; /// The result of some pass: Some output `T` and feedback data. diff --git a/src/macros.rs b/src/macros.rs deleted file mode 100644 index 710af1e6c..000000000 --- a/src/macros.rs +++ /dev/null @@ -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, - } - }; -} diff --git a/src/parse/tests.rs b/src/parse/tests.rs index 4315fd2c6..21375a0f2 100644 --- a/src/parse/tests.rs +++ b/src/parse/tests.rs @@ -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")); diff --git a/src/prelude.rs b/src/prelude.rs index 0fab6fbbd..899ced7da 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -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}; diff --git a/src/syntax/ast/lit.rs b/src/syntax/ast/lit.rs index c08dc8cd6..3b6441e7a 100644 --- a/src/syntax/ast/lit.rs +++ b/src/syntax/ast/lit.rs @@ -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 diff --git a/src/syntax/span.rs b/src/syntax/span.rs index 09e5f02cd..e9e1021c7 100644 --- a/src/syntax/span.rs +++ b/src/syntax/span.rs @@ -83,7 +83,7 @@ impl Spanned { } impl Spanned> { - /// Swap the spanned and option. + /// Swap the spanned and the option. pub fn transpose(self) -> Option> { let Spanned { v, span } = self; v.map(|v| v.span_with(span)) diff --git a/src/syntax/token.rs b/src/syntax/token.rs index e3fada434..cb0526c14 100644 --- a/src/syntax/token.rs +++ b/src/syntax/token.rs @@ -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