From 5ca7658bed226981567e0de4c107695ed3458770 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 5 Oct 2026 23:24:24 +1300 Subject: [PATCH 1/2] Normalize unordered list markers as hyphens. --- context/markdown-normalization.md | 3 ++- releases.md | 4 ++++ src/lib.rs | 1 + src/tests.rs | 11 +++++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/context/markdown-normalization.md b/context/markdown-normalization.md index f11d52a..95b0682 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 `-` for +unordered list markers. 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/lib.rs b/src/lib.rs index e7e15d0..617a810 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,6 +50,7 @@ pub fn normalize_document_with_options( &tree, &MarkdownOptions { line_wrapping: LineWrapping::Unwrap, + bullet: '-', ..MarkdownOptions::default() }, ) 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" ); } From d54395b0bcc8fbb4a5fb3f16db572d59050789a4 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 6 Oct 2026 00:02:35 +1300 Subject: [PATCH 2/2] Rely on socketry-markdown 0.3.0's hyphen default. --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- context/markdown-normalization.md | 4 ++-- src/lib.rs | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) 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 95b0682..f84e8fb 100644 --- a/context/markdown-normalization.md +++ b/context/markdown-normalization.md @@ -13,8 +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. It uses `-` for -unordered list markers. +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/src/lib.rs b/src/lib.rs index 617a810..e7e15d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,7 +50,6 @@ pub fn normalize_document_with_options( &tree, &MarkdownOptions { line_wrapping: LineWrapping::Unwrap, - bullet: '-', ..MarkdownOptions::default() }, )