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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ same stability guarantee.

## [0.9.0] — 2026-07-16

### Fixed

- **A trailing `# comment` after a plain scalar no longer breaks front-matter
parsing.** YAML like `- date: 2025-01-01 # when` inside a block sequence
(e.g. a policy revision entry) previously failed the whole document with
`ParseFailure`. Fixed upstream in the sc2in/zig-yaml fork (0.3.1, "comment
terminates a plain scalar"); this release bumps the pin and adds
front-matter regression tests.

### Added

- **Opt-in TeX math** (`Parser{ .math = true }`; off by default). `$…$` parses
Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
.lazy = true,
},
.yaml = .{
.url = "git+https://github.com/sc2in/zig-yaml#691a2c37f1546fe843f7080fd7bf4450f1facb2e",
.hash = "zig_yaml-0.3.0-C1161oSpAgCiEJXrktVkXNSWNQifQ8NWvNB-20PqoFc3",
.url = "git+https://github.com/sc2in/zig-yaml#7c60d9cd6ae596c8247ac74b5b8e32c329e7c1d0",
.hash = "zig_yaml-0.3.1-C1161s2zAgBOYGjCQB3uWdAadPevfdNiTaffefbhAhBq",
},
},
// Specifies the set of files and directories that are included in this package.
Expand Down
6 changes: 3 additions & 3 deletions build.zig.zon2json-lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
"url": "git+https://github.com/mnemnion/mvzr?ref=v0.3.10#dd0e1bd2d6b10f9650317b30baef7ab7bc9dd9ec",
"hash": "sha256-hUGdJPjC1PAm6zWL9eAE7A+wAfzf6Q7uSutT2Xe7EMU="
},
"zig_yaml-0.3.0-C1161oSpAgCiEJXrktVkXNSWNQifQ8NWvNB-20PqoFc3": {
"zig_yaml-0.3.1-C1161s2zAgBOYGjCQB3uWdAadPevfdNiTaffefbhAhBq": {
"name": "yaml",
"url": "git+https://github.com/sc2in/zig-yaml#691a2c37f1546fe843f7080fd7bf4450f1facb2e",
"hash": "sha256-8BNs41Ch8CmvRME13b6xXTD6VN2/2LewIsW7kp30tCY="
"url": "git+https://github.com/sc2in/zig-yaml#7c60d9cd6ae596c8247ac74b5b8e32c329e7c1d0",
"hash": "sha256-JAYq7B7gXd4+c60KXZ9b5IuaKLY7x7Bn9TNynyx4kog="
}
}
28 changes: 28 additions & 0 deletions src/markdown/frontmatter_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -978,3 +978,31 @@ test "frontmatter: parseFieldArg errors" {
try tst.expectError(error.InvalidFieldArg, FrontMatter.parseFieldArg("no-equals-sign"));
try tst.expectError(error.InvalidFieldArg, FrontMatter.parseFieldArg("=value-no-path"));
}

test "frontmatter: trailing comment on a block-sequence mapping line" {
// Regression: a trailing `# comment` after a plain scalar inside a block
// sequence (e.g. a policy revision entry) made the whole front matter
// fail with ParseFailure before zig-yaml 0.3.1.
const md =
"---\n" ++
"extra:\n" ++
" major_revisions:\n" ++
" - date: 2025-01-01 # when it happened\n" ++
" version: \"1.0\"\n" ++
"---\n" ++
"Body.\n";
var fm = try FrontMatter.initFromMarkdown(tst.allocator, md);
defer fm.deinit();
const revs = fm.get("extra.major_revisions") orelse return error.Missing;
try tst.expectEqual(@as(usize, 1), revs.array.items.len);
const date = revs.array.items[0].object.get("date") orelse return error.Missing;
try tst.expectEqualStrings("2025-01-01", date.string);
}

test "frontmatter: trailing comment keeps top-level scalar intact" {
const md = "---\ntitle: My Policy # a note\n---\nBody.\n";
var fm = try FrontMatter.initFromMarkdown(tst.allocator, md);
defer fm.deinit();
const t = fm.get("title") orelse return error.Missing;
try tst.expectEqualStrings("My Policy", t.string);
}
Loading