diff options
| author | Laurenz <laurmaedje@gmail.com> | 2025-01-06 14:55:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-06 13:55:34 +0000 |
| commit | cb8d862a55601127a1e3ff02feaefdabd37b583f (patch) | |
| tree | 098013eee3b3d0a3dacf7e47c81566121005df30 | |
| parent | e8bbf3794fb077cdd35095467eb763b476ee7e99 (diff) | |
Terminate pretty-printed HTML with trailing newline (#5661)
| -rw-r--r-- | crates/typst-html/src/encode.rs | 3 | ||||
| -rw-r--r-- | tests/ref/html/heading-html-basic.html | 2 | ||||
| -rw-r--r-- | tests/ref/html/link-basic.html | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/crates/typst-html/src/encode.rs b/crates/typst-html/src/encode.rs index b87b0e1d..62146f86 100644 --- a/crates/typst-html/src/encode.rs +++ b/crates/typst-html/src/encode.rs @@ -12,6 +12,9 @@ pub fn html(document: &HtmlDocument) -> SourceResult<String> { w.buf.push_str("<!DOCTYPE html>"); write_indent(&mut w); write_element(&mut w, &document.root)?; + if w.pretty { + w.buf.push('\n'); + } Ok(w.buf) } diff --git a/tests/ref/html/heading-html-basic.html b/tests/ref/html/heading-html-basic.html index 69a1d017..56b1e32b 100644 --- a/tests/ref/html/heading-html-basic.html +++ b/tests/ref/html/heading-html-basic.html @@ -27,4 +27,4 @@ Level 7 </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/tests/ref/html/link-basic.html b/tests/ref/html/link-basic.html index 1f4e02e1..5d998667 100644 --- a/tests/ref/html/link-basic.html +++ b/tests/ref/html/link-basic.html @@ -18,4 +18,4 @@ Contact <a href="mailto:hi@typst.app">hi@typst.app</a> or call <a href="tel:123">123</a> for more information. </p> </body> -</html>
\ No newline at end of file +</html> |
