Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

refactor(typst): move comment to be doc comment of new function

Grant Lemons03a0f8403bf9
diff --git a/harper-typst/src/lib.rs b/harper-typst/src/lib.rs
index bbd51aa95..2cd2124ba 100644
--- a/harper-typst/src/lib.rs
+++ b/harper-typst/src/lib.rs
@@ -36,6 +36,11 @@ impl Parser for Typst {
}
}
+/// Converts newlines after certain elements to paragraph breaks
+/// This is accomplished here instead of in the translating module because at this point there is
+/// still semantic information associated with the elements.
+///
+/// Newlines are separate expressions in the parse tree (as the Space variant)
fn convert_parbreaks<'a>(buf: &'a mut Vec<SyntaxNode>, exprs: &'a [Expr]) -> Vec<Expr<'a>> {
// Owned collection of nodes forcibly casted to paragraph breaks
*buf = exprs
@@ -47,11 +52,6 @@ fn convert_parbreaks<'a>(buf: &'a mut Vec<SyntaxNode>, exprs: &'a [Expr]) -> Vec
})
.collect_vec();
- // Converts newlines after certain elements to paragraph breaks
- // This is accomplished here instead of in the translating module because at this point there is
- // still semantic information associated with the elements.
- //
- // Newlines are separate expressions in the parse tree (as the Space variant)
let should_parbreak = |e1, e2, e3| {
matches!(e2, Expr::Space(_))
&& (matches!(e1, Expr::Heading(_) | Expr::List(_))