summaryrefslogtreecommitdiff
path: root/src/library/math.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/math.rs')
-rw-r--r--src/library/math.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/library/math.rs b/src/library/math.rs
index d3c8b5e5..40a1990e 100644
--- a/src/library/math.rs
+++ b/src/library/math.rs
@@ -22,11 +22,18 @@ impl MathNode {
}
impl Show for MathNode {
- fn show(&self, _: &mut Vm, _: StyleChain) -> TypResult<Template> {
- let mut template = Template::Text(self.formula.trim().into());
- if self.display {
- template = Template::Block(template.pack());
- }
- Ok(template.monospaced())
+ fn show(&self, vm: &mut Vm, styles: StyleChain) -> TypResult<Template> {
+ Ok(styles
+ .show(self, vm, [
+ Value::Str(self.formula.clone()),
+ Value::Bool(self.display),
+ ])?
+ .unwrap_or_else(|| {
+ let mut template = Template::Text(self.formula.trim().into());
+ if self.display {
+ template = Template::Block(template.pack());
+ }
+ template.monospaced()
+ }))
}
}