Skip to content

feat(kiritan): keep leading YAML front matter verbatim - #49

Merged
otnc merged 1 commit into
mainfrom
feat/kiritan-frontmatter-protection
Sep 19, 2026
Merged

otnc merged 1 commit into
mainfrom
feat/kiritan-frontmatter-protection

Conversation

@otnc

@otnc otnc commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix bug(s)
  • New feature(s)
  • Others

A leading --- YAML block is now kept as one opaque node (via remark-frontmatter), so it survives parse/stringify verbatim and interpolation never touches it. Before, it was parsed as a thematic break plus a setext heading and got mangled on output.

The translateFrontmatter option from the design doc is dropped: inline/catalog have no place for a per-locale value, and a sidecar translation already owns its own front matter. DESIGN.md chapter 6 and the roadmap are updated to match.

Why?

This is the first step of the text/mdx renderer roadmap item, and it is useful on its own for any Markdown source that carries front matter.

Related issue(s)

closes

Check

  • Check if duplicate PR(s) already exist.
  • Read CONTRIBUTING.md (rules)
  • Run npm run check (lint & format)
  • Run npm run typecheck
  • Run npm run test (functions test)
  • Run npm run build (dist/)
  • (optional) Run npm run test:coverage and check nothing new went uncovered

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedremark-frontmatter@​5.0.010010010083100

View full report

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Preserve leading front matter in the missing-sidecar path and add an integration regression test.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds opaque YAML front-matter preservation for Markdown parsing, stringifying, and interpolation.

Changes:

  • Adds remark-frontmatter support and regression tests.
  • Updates dependencies and design documentation.
  • Drops the proposed translateFrontmatter option.
File Summary
packages/​kiritan/​src/​interpolate/​index.test.ts Tests interpolation exclusion for front matter.
packages/​kiritan/​src/​directive/​parse.ts Adds front-matter handling; missing-sidecar ordering still requires correction.
packages/​kiritan/​src/​directive/​parse.test.ts Tests YAML parsing and round-tripping.
packages/​kiritan/​package.json Adds the front-matter dependency.
package-lock.json Locks dependency updates.
docs/​DESIGN.md Updates English design documentation.
docs/​DESIGN.ja.md Updates Japanese design documentation.
base/​DESIGN.base.md Updates roadmap source documentation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +9 to +11
const parser = unified()
.use(remarkParse)
.use(remarkFrontmatter)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #55: the fallback marker now goes after leading front matter, with an integration test through build.

@otnc
otnc merged commit 0409a54 into main Sep 19, 2026
5 checks passed
@otnc
otnc deleted the feat/kiritan-frontmatter-protection branch September 19, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants