diff --git a/Cargo.lock b/Cargo.lock index e052c11..af1c4a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,7 +86,7 @@ name = "bake-markdown" version = "0.2.0" dependencies = [ "bake", - "socketry-markdown 0.2.0", + "socketry-markdown 0.3.0", "tempfile", ] @@ -663,9 +663,9 @@ dependencies = [ [[package]] name = "socketry-markdown" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3a646262edeca60e86e4c4dd493167e74beb03ea75a60b2d5c40e6d6d8c5b" +checksum = "8c02f802fe678b660dd21a6b6130bc2d0eb3423c24b9f26ebddb46514769e788" dependencies = [ "regex", "unicode-id", diff --git a/Cargo.toml b/Cargo.toml index 0020f3e..9e1261a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ reviewers = ["socketry/managers"] [dependencies] bake = ">=0.19.0" -socketry-markdown = "0.2.0" +socketry-markdown = "0.3.0" [dev-dependencies] tempfile = "3.27" diff --git a/context/markdown-normalization.md b/context/markdown-normalization.md index f11d52a..f84e8fb 100644 --- a/context/markdown-normalization.md +++ b/context/markdown-normalization.md @@ -13,7 +13,8 @@ The serializer preserves explicit Markdown hard breaks, code contents, and block boundaries. YAML and TOML front matter are parsed as front matter so their delimiters and content remain intact. The serializer canonicalizes line endings to LF and emits a trailing newline for non-empty documents. The -normalizer does not wrap paragraphs to a target line width. +normalizer does not wrap paragraphs to a target line width. It uses the +serializer's default `-` marker for unordered lists. The task accepts one or more positional paths, resolved relative to the Bake project root. For example, the shell expands a glob before Bake receives the diff --git a/releases.md b/releases.md index 7db1b28..483f0ef 100644 --- a/releases.md +++ b/releases.md @@ -1,5 +1,9 @@ # Releases +## Unreleased + +- Normalize unordered Markdown lists with hyphen markers. + ## v0.2.0 - Accept Markdown paths as positional arguments to `markdown:normalize`. diff --git a/src/tests.rs b/src/tests.rs index 9e5d42e..a2d0af9 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -32,6 +32,13 @@ fn normalization_is_idempotent() { assert_eq!(second, first); } +#[test] +fn normalizes_unordered_lists_to_hyphen_markers() { + let normalized = normalize_document("* first\n* second\n").unwrap(); + + assert_eq!(normalized, "- first\n- second\n"); +} + #[test] fn preserves_front_matter_and_unwraps_nested_phrasing() { let source = "---\ntitle: Example\n---\n\nA *wrapped\nemphasis* paragraph.\n"; @@ -70,14 +77,14 @@ fn preserves_inline_code_and_math() { } #[test] -fn preserves_gfm_tables_and_other_gfm_constructs() { +fn preserves_gfm_tables_and_normalizes_task_list_markers() { let source = "| key | value |\n| --- | --- |\n| name | Ada |\n\n~~removed~~ and a task:\n\n- [x] done\n- [ ] pending\n\nA claim[^note].\n\n[^note]: A note.\n"; let normalized = normalize_document(source).unwrap(); assert_eq!( normalized, - "| key | value |\n| --- | --- |\n| name | Ada |\n\n~~removed~~ and a task:\n\n* [x] done\n* [ ] pending\n\nA claim[^note].\n\n[^note]: A note.\n" + "| key | value |\n| --- | --- |\n| name | Ada |\n\n~~removed~~ and a task:\n\n- [x] done\n- [ ] pending\n\nA claim[^note].\n\n[^note]: A note.\n" ); }