diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-05-17 14:41:46 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-05-17 14:41:46 +0200 |
| commit | 551ea99d05166b0be50792f767ddd38b996e32fa (patch) | |
| tree | ec5e86a087e79e8c181c7d4b904216a775227e2d /docs | |
| parent | 46aace78ac4ac1c075b9b1670dbb7372df1a0a82 (diff) | |
Show default values in documentation
Fixes #169
Fixes #1102
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/src/lib.rs b/docs/src/lib.rs index 2a7b7c5f..a9a640f6 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -492,6 +492,7 @@ pub struct ParamModel { pub example: Option<Html>, pub types: Vec<&'static str>, pub strings: Vec<StrParam>, + pub default: Option<Html>, pub positional: bool, pub named: bool, pub required: bool, @@ -532,6 +533,10 @@ fn param_model(resolver: &dyn Resolver, info: &ParamInfo) -> ParamModel { example: example.map(|md| Html::markdown(resolver, md)), types, strings, + default: info.default.map(|default| { + let node = typst::syntax::parse_code(&default().repr()); + Html::new(typst::ide::highlight_html(&node)) + }), positional: info.positional, named: info.named, required: info.required, @@ -721,6 +726,7 @@ fn method_model(resolver: &dyn Resolver, part: &'static str) -> MethodModel { example: None, types, strings: vec![], + default: None, positional, named, required, |
