Skip to content

Commit

Permalink
refactor(typst): move comment to be doc comment of new function
Browse files Browse the repository at this point in the history
  • Loading branch information
grantlemons committed Jan 21, 2025
1 parent 977b08b commit 0f40a27
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions harper-typst/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(_))
Expand Down

0 comments on commit 0f40a27

Please sign in to comment.