summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/syntax/ast.rs3
1 files changed, 3 insertions, 0 deletions
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);