Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 2 additions & 1 deletion context/markdown-normalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions releases.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
11 changes: 9 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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"
);
}

Expand Down
Loading