Documents: inline formulas typeset in text; \( and \[ read as math
This commit is contained in:
12 files changed
+569
-61
No files matched your search
@@ -318,12 +318,14 @@ impl<'a> Reader<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Text split at its images; lone `$$` math is block.
|
||||
/// Text split at its images; lone `$$` or `\[` math is block.
|
||||
fn paragraph(&self, node: &mdast::Node, children: &[mdast::Node], out: &mut Vec<Node>) {
|
||||
if let [mdast::Node::InlineMath(math)] = children
|
||||
&& self.source[span(node)].starts_with("$$")
|
||||
&& ["$$", "\\["]
|
||||
.iter()
|
||||
.any(|open| self.source[span(node)].starts_with(open))
|
||||
{
|
||||
return out.push(Node::Math(math.value.clone()));
|
||||
return out.push(Node::Math(math.value.trim().to_string()));
|
||||
}
|
||||
let mut run = Run {
|
||||
table: matches!(node, mdast::Node::TableCell(_)),
|
||||
|
||||
Reference in new issue
Block a user