diff --git a/src/pretty.rs b/src/pretty.rs index e95d1a0..e7684ae 100644 --- a/src/pretty.rs +++ b/src/pretty.rs @@ -177,7 +177,11 @@ impl PrettyPrinter { } if let Some(lang) = child.cast::() { doc = doc.append(trivia(lang.to_untyped())); - doc = doc.append(BoxDoc::hardline()); + doc = doc.append(if is_block { + BoxDoc::hardline() + } else { + BoxDoc::space() + }); } if let Some(line) = child.cast::() { doc = doc.append(trivia(line.to_untyped())); diff --git a/tests/assets/unit/markup/raw.typ b/tests/assets/unit/markup/raw.typ index 09c8727..13f6180 100644 --- a/tests/assets/unit/markup/raw.typ +++ b/tests/assets/unit/markup/raw.typ @@ -45,3 +45,10 @@ let a = 1; let d = 1; ``` ] + + +```typ #link()``` + + +```typ #link() +``` diff --git a/tests/snapshots/assets__check_file@unit-markup-raw.typ-120.snap b/tests/snapshots/assets__check_file@unit-markup-raw.typ-120.snap index ae7881a..a7e12df 100644 --- a/tests/snapshots/assets__check_file@unit-markup-raw.typ-120.snap +++ b/tests/snapshots/assets__check_file@unit-markup-raw.typ-120.snap @@ -50,3 +50,9 @@ let a = 1; let d = 1; ``` ] + +```typ #link()``` + +```typ +#link() +``` diff --git a/tests/snapshots/assets__check_file@unit-markup-raw.typ-40.snap b/tests/snapshots/assets__check_file@unit-markup-raw.typ-40.snap index ae7881a..a7e12df 100644 --- a/tests/snapshots/assets__check_file@unit-markup-raw.typ-40.snap +++ b/tests/snapshots/assets__check_file@unit-markup-raw.typ-40.snap @@ -50,3 +50,9 @@ let a = 1; let d = 1; ``` ] + +```typ #link()``` + +```typ +#link() +``` diff --git a/tests/snapshots/assets__check_file@unit-markup-raw.typ-80.snap b/tests/snapshots/assets__check_file@unit-markup-raw.typ-80.snap index ae7881a..a7e12df 100644 --- a/tests/snapshots/assets__check_file@unit-markup-raw.typ-80.snap +++ b/tests/snapshots/assets__check_file@unit-markup-raw.typ-80.snap @@ -50,3 +50,9 @@ let a = 1; let d = 1; ``` ] + +```typ #link()``` + +```typ +#link() +```