Documents: inline formulas typeset in text; \( and \[ read as math
CI / platforms (ubuntu-24.04) (push) Waiting to run
CI / site (push) Successful in 35s
CI / crate (push) Failing after 35s
CI / platforms (windows-latest) (push) Successful in 5m41s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-18 22:42:07 -04:00
1 parent 7d704d97f4
commit dceca9f3c6
12 files changed
+569 -61

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ use std::ops::Range;
use markdown::mdast::Node;
use super::{Change, EditRefusal, after, block, cut, holder, marks, room};
use crate::documents::{markdown::span, tree::inside};
use crate::documents::markdown::{math_inside, span};
/// The backslashes of escapes in a text node's span.
fn escapes(text: &str, whole: Range<usize>) -> Vec<Range<usize>> {
@@ -33,7 +33,7 @@ fn meta(node: &Node, text: &str, autolinks: &[Range<usize>]) -> Vec<Range<usize>
Node::Text(_) if holder(autolinks, &whole).is_some() => Vec::new(),
Node::Text(_) => escapes(text, whole),
Node::InlineMath(_) => {
let inner = inside(text, whole.clone(), '$');
let inner = math_inside(text, whole.clone());
vec![whole.start..inner.start, inner.end..whole.end]
}
Node::FootnoteReference(_) => vec![whole.start..whole.start + 2, whole.end - 1..whole.end],