Skip to content

Commit

Permalink
Upgrade pulldown-cmark-to-cmark to 19.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kdarkhan committed Dec 11, 2024
1 parent 0fdaff1 commit 67022cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion i18n-helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dateparser = "0.2.1"
mdbook.workspace = true
polib.workspace = true
pulldown-cmark = { version = "0.12.2", default-features = false, features = ["html"] }
pulldown-cmark-to-cmark = "18.0.0"
pulldown-cmark-to-cmark = "19.0.1"
regex = "1.11"
semver = "1.0.23"
serde_json.workspace = true
Expand Down
13 changes: 8 additions & 5 deletions i18n-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,11 +652,14 @@ pub fn reconstruct_markdown<'a>(
// Markdown without the padding to remove the effect of these
// structural elements. Similarly, we don't want extra newlines at
// the start.
let simplified_state = state.map(|state| State {
newlines_before_start: 0,
padding: Vec::new(),
..state
});
// Because State is marked as non_exhaustive, we can't do
// more intuitive mappping/constructing a new instance. Instead,
// doing a clone and in-place mutation.
let mut simplified_state = state.clone();
if let Some(ref mut state) = simplified_state {
state.newlines_before_start = 0;
state.padding = Vec::new();
}
cmark_resume_with_options(events, &mut markdown, simplified_state, options).unwrap();
// Even with `newlines_before_start` set to zero, we get a leading
// `\n` for code blocks (since they must start on a new line). We
Expand Down

0 comments on commit 67022cf

Please sign in to comment.