feat: support subscript and superscript

This commit is contained in:
PoiScript 2023-11-21 18:41:17 +08:00
parent 58dfb022c2
commit 8b5c545d4b
No known key found for this signature in database
GPG key ID: 22C2B1249D99985E
12 changed files with 346 additions and 63 deletions

View file

@ -518,4 +518,20 @@ impl Traverser for HtmlExport {
ctx.skip();
}
}
#[tracing::instrument(skip(self, _ctx))]
fn subscript(&mut self, event: WalkEvent<&Subscript>, _ctx: &mut TraversalContext) {
match event {
WalkEvent::Enter(_) => self.output += "<sub>",
WalkEvent::Leave(_) => self.output += "</sub>",
}
}
#[tracing::instrument(skip(self, _ctx))]
fn superscript(&mut self, event: WalkEvent<&Superscript>, _ctx: &mut TraversalContext) {
match event {
WalkEvent::Enter(_) => self.output += "<sup>",
WalkEvent::Leave(_) => self.output += "</sup>",
}
}
}