From 507efc3a1c14e8487705c7424d605a1663d3fe6e Mon Sep 17 00:00:00 2001 From: MALO <57839069+MDLC01@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:23:14 +0200 Subject: Do not take empty lines into account when computing `raw` block dedent (#1676) --- crates/typst/src/syntax/ast.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates') diff --git a/crates/typst/src/syntax/ast.rs b/crates/typst/src/syntax/ast.rs index 4a0de424..48be1b07 100644 --- a/crates/typst/src/syntax/ast.rs +++ b/crates/typst/src/syntax/ast.rs @@ -565,6 +565,9 @@ impl Raw { let dedent = lines .iter() .skip(1) + .filter(|line| !line.chars().all(char::is_whitespace)) + // The line with the closing ``` is always taken into account + .chain(lines.last()) .map(|line| line.chars().take_while(|c| c.is_whitespace()).count()) .min() .unwrap_or(0); -- cgit v1.2.3