fix: trailing linebreaks at end of paragraph (#1820)
Some checks failed
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / E2E Tests (darwin-arm64 on macos-latest) (push) Has been cancelled
tinymist::ci / E2E Tests (linux-x64 on ubuntu-22.04) (push) Has been cancelled
tinymist::ci / E2E Tests (linux-x64 on ubuntu-latest) (push) Has been cancelled
tinymist::ci / E2E Tests (win32-x64 on windows-2019) (push) Has been cancelled
tinymist::ci / E2E Tests (win32-x64 on windows-latest) (push) Has been cancelled
tinymist::ci / build-binary (push) Has been cancelled
tinymist::ci / build-vsc-assets (push) Has been cancelled
tinymist::ci / build-vscode (push) Has been cancelled
tinymist::ci / build-vscode-others (push) Has been cancelled
tinymist::ci / publish-vscode (push) Has been cancelled

This commit is contained in:
Hong Jiarong 2025-06-17 17:57:02 +08:00 committed by GitHub
parent 79fee262d7
commit ee528810fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 64 additions and 6 deletions

8
Cargo.lock generated
View file

@ -581,9 +581,9 @@ dependencies = [
[[package]]
name = "cmark-writer"
version = "0.7.6"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f10f0b392cc21023a462ef0972118edbf4616f5eb8546f3434c53353ba12f9a"
checksum = "455314fe1e891d575c1b853f7765488ed9fc6a6e16a953ba21bbea931dc337f3"
dependencies = [
"cmark-writer-macros",
"ecow",
@ -594,9 +594,9 @@ dependencies = [
[[package]]
name = "cmark-writer-macros"
version = "0.7.6"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be7dbe651b0dee1bfd8a1a93efe76a43d6bbdee978b802102a9c14d070e8221c"
checksum = "71313c3ee31ef1b5e7f043248fbc1cff399a28fa88634caf1264852ee16f359a"
dependencies = [
"proc-macro2",
"quote",

View file

@ -97,7 +97,7 @@ rpds = "1"
# Data/Text Format and Processing
biblatex = "0.10"
cmark-writer = { version = "0.7.6", features = ["gfm"] }
cmark-writer = { version = "0.7.7", features = ["gfm"] }
docx-rs = { version = "0.4.18-rc19", git = "https://github.com/Myriad-Dreamin/docx-rs", default-features = false, rev = "db49a729f68dbdb9e8e91857fbb1c3d414209871" }
hayagriva = "0.8"
hex = "0.4.3"

View file

@ -0,0 +1,4 @@
Text2 \
Text1 \
== H1

View file

@ -0,0 +1,20 @@
---
source: crates/typlite/src/tests.rs
expression: "conv(world, ConvKind::Md { for_docs: false })"
input_file: crates/typlite/src/fixtures/integration/linebreak.typ
snapshot_kind: text
---
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body><m1document><p>Text2</p><m1linebreak></m1linebreak><p>Text1</p><m1linebreak></m1linebreak><m1parbreak></m1parbreak><m1heading level="2"><span style="display: inline-block;">H1</span></m1heading></m1document></body>
</html>
=====
Text2\
Text1
### H1

View file

@ -0,0 +1,26 @@
---
source: crates/typlite/src/tests.rs
expression: "conv(world, ConvKind::LaTeX)"
input_file: crates/typlite/src/fixtures/integration/linebreak.typ
snapshot_kind: text
---
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body><m1document><p>Text2</p><m1linebreak></m1linebreak><p>Text1</p><m1linebreak></m1linebreak><m1parbreak></m1parbreak><m1heading level="2"><span style="display: inline-block;">H1</span></m1heading></m1document></body>
</html>
=====
\begin{document}
Text2\\
Text1\\
\subsection{H1}
\end{document}

View file

@ -0,0 +1,7 @@
---
source: crates/typlite/src/tests.rs
expression: hash
input_file: crates/typlite/src/fixtures/integration/linebreak.typ
snapshot_kind: text
---
siphash128_13:11003fd26842db430e7341d9aad00927

View file

@ -225,7 +225,7 @@
},
)
// show linebreak: it => if-not-paged(it, md-linebreak)
show linebreak: it => if-not-paged(it, md-linebreak)
show figure: it => if-not-paged(it, md-figure(it.body, caption: it.caption))
html.elem("m1document", body)

View file

@ -23,6 +23,7 @@ impl FormatWriter for MarkdownWriter {
let mut writer = CommonMarkWriter::with_options(WriterOptions {
strict: false,
escape_special_chars: true,
trim_paragraph_trailing_hard_breaks: true,
..Default::default()
});
writer