diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-05-16 15:02:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-16 13:02:55 +0000 |
| commit | aad68ea48972787ca540295c4ee740aec6a72a0b (patch) | |
| tree | 715d4bb55a9e2bb47e7882d26e0a0c254a0842f3 /docs/src | |
| parent | 7c4a199918cd4d9ce6af931a01b09ef7a29fc2c6 (diff) | |
Documentation for literals (#4149)
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/lib.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/docs/src/lib.rs b/docs/src/lib.rs index 66242cbb..ab8e2d51 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -14,7 +14,9 @@ use once_cell::sync::Lazy; use serde::Deserialize; use serde_yaml as yaml; use typst::diag::{bail, StrResult}; +use typst::foundations::AutoValue; use typst::foundations::Bytes; +use typst::foundations::NoneValue; use typst::foundations::{ CastInfo, Category, Func, Module, ParamInfo, Repr, Scope, Smart, Type, Value, FOUNDATIONS, @@ -56,12 +58,21 @@ static GROUPS: Lazy<Vec<GroupData>> = Lazy::new(|| { static LIBRARY: Lazy<LazyHash<Library>> = Lazy::new(|| { let mut lib = Library::default(); + let scope = lib.global.scope_mut(); + + // Add those types, so that they show up in the docs. + scope.category(FOUNDATIONS); + scope.define_type::<NoneValue>(); + scope.define_type::<AutoValue>(); + + // Adjust the default look. lib.styles .set(PageElem::set_width(Smart::Custom(Abs::pt(240.0).into()))); lib.styles.set(PageElem::set_height(Smart::Auto)); lib.styles.set(PageElem::set_margin(Margin::splat(Some(Smart::Custom( Abs::pt(15.0).into(), ))))); + LazyHash::new(lib) }); @@ -240,7 +251,7 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel { shorthands = Some(ShorthandsModel { markup, math }); } - // Add functions. + // Add values and types. let scope = module.scope(); for (name, value) in scope.iter() { if scope.get_category(name) != Some(category) { |
