diff --git a/Cargo.lock b/Cargo.lock index 5899f1d..dba8146 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler" @@ -981,9 +981,9 @@ checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" [[package]] name = "pulldown-cmark-to-cmark" -version = "18.0.0" +version = "19.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e02b63adcb49f2eb675b1694b413b3e9fedbf549dfe2cc98727ad97a0c30650" +checksum = "e84a87de49d1b6c63f0998da7ade299905387ae1feae350efc98e0632637f589" dependencies = [ "pulldown-cmark 0.12.2", ] diff --git a/i18n-helpers/Cargo.toml b/i18n-helpers/Cargo.toml index 729b1e8..3fc4858 100644 --- a/i18n-helpers/Cargo.toml +++ b/i18n-helpers/Cargo.toml @@ -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 diff --git a/i18n-helpers/src/lib.rs b/i18n-helpers/src/lib.rs index 7d1b3d4..a4244d8 100644 --- a/i18n-helpers/src/lib.rs +++ b/i18n-helpers/src/lib.rs @@ -652,11 +652,17 @@ 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 - }); + let simplified_state = { + // Because State is marked as non_exhaustive, we can't do + // more intuitive mapping/constructing a new instance. Instead, + // doing a clone and in-place mutation. + let mut cloned_state = state.clone(); + if let Some(ref mut state) = cloned_state { + state.newlines_before_start = 0; + state.padding = Vec::new(); + } + cloned_state + }; 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