Skip to content

Add GFM alerts and front-matter support - #37

Merged
maphew merged 4 commits into
mainfrom
feature/mdo-4pm-1-markdown-upgrade
Aug 23, 2026
Merged

Add GFM alerts and front-matter support#37
maphew merged 4 commits into
mainfrom
feature/mdo-4pm-1-markdown-upgrade

Conversation

@maphew

@maphew maphew commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Add regression coverage that exercises SVG set and animate URL filtering and fails against the vulnerable dependency release.

Agent-Signature: codex-gpt-5.2-high on behalf of Matt Wilkie
Agent-Signature: codex-unknown-model- on behalf of Matt Wilkie
@kilo-code-bot

kilo-code-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • src/lib.rs - GFM alerts CSS, YAML front-matter handling, pulldown-cmark 0.13 upgrade
  • tests/cli.rs - cfg-gated unix-only imports
  • CHANGELOG.md - unreleased entries
Previous Review Summary (commit 51465f5)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 51465f5)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • src/lib.rs - GFM alerts CSS, YAML front-matter title extraction, pulldown-cmark 0.13 upgrade
  • Cargo.toml - dependency version bump
  • Cargo.lock - auto-generated, skipped

Reviewed by step-3.7-flash · Input: 59.7K · Output: 16.3K · Cached: 221.2K

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51465f5c21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Outdated
Address PR #37 review findings:

- Strip YAML front matter before parsing instead of enabling
  ENABLE_YAML_STYLE_METADATA_BLOCKS: pulldown-cmark 0.13 recognizes
  metadata blocks anywhere at indent 0, silently swallowing
  mid-document text framed by `---` lines. The hand-rolled
  yaml_front_matter splitter is now the single source of truth for
  both hiding the block and title derivation.
- Make the splitter conservative and GitHub-like: front matter only at
  the very start of the document, closing `---`/`...` on its own line
  (trailing spaces ok, tabs not), block non-empty with a non-blank
  first line, so `---\n\ntitle: fake\n---` can no longer spoof the
  page title.
- Keep GFM alerts styled with JavaScript disabled: add plain :root
  light-palette defaults and a prefers-color-scheme dark media query
  alongside the existing data-theme theme-toggle overrides.
- Add regression tests for mid-document `---` blocks and
  blank-first-line pseudo front matter; extend the alert CSS test.
- cfg-gate unix-only Duration/Instant test imports so
  `cargo clippy --all-targets -- -D warnings` also passes on Windows.
- Record GFM alerts and YAML front matter in the changelog.

Agent-Signature: claude-code-fable-5 on behalf of maphew
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GvsZX2KKgN6BrCCrNrJ5BW
@maphew

maphew commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

Pushed 9b7f5e2 addressing the review findings:

  1. Mid-document content loss (major): removed ENABLE_YAML_STYLE_METADATA_BLOCKS from the parser options — pulldown-cmark 0.13 recognizes metadata blocks anywhere at indent 0, so ----framed text mid-document was silently swallowed. Front matter is now stripped before parsing by the same yaml_front_matter() splitter that title derivation uses, making it the single source of truth.

  2. Title spoofing via blank-first-line blocks (moderate): the splitter is now conservative and GitHub-like: front matter only at the very start of the document, closing ---/... on its own line (trailing spaces ok, tabs not), and the block must be non-empty with a non-blank first line. ---\n\ntitle: fake\n--- no longer sets the page title and its text stays visible. Rules are documented on the function.

  3. Alerts unstyled without JavaScript (minor): GFM_ALERTS_CSS now ships plain :root light-palette defaults plus a @media (prefers-color-scheme: dark) block, with the existing higher-specificity data-theme overrides still winning once the theme toggle runs.

  4. Regression tests: mid-document --- blocks render their text and keep the H1 title; blank-first-line pseudo front matter is rejected (body visible, title from the real H1, empty blocks also rejected); the alert-CSS test asserts the no-JS defaults. All 61 existing + new Rust tests and the Python tests pass; cargo fmt and cargo clippy --all-targets --all-features -- -D warnings are clean.

  5. CHANGELOG: added Unreleased entries for GFM alerts and YAML front matter.

Also cfg-gated the unix-only Duration/Instant imports in tests/cli.rs so the clippy gate passes on Windows too.

claude-code-fable-5 on behalf of maphew

@maphew
maphew deleted the branch main August 23, 2026 18:07
@maphew maphew closed this Aug 23, 2026
@maphew maphew reopened this Aug 23, 2026
@maphew
maphew changed the base branch from fix/mdo-9p5-ammonia to main August 23, 2026 18:08

@maphew maphew left a comment

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.

Reviewed the current head as the second layer of the stack, including commit 9b7f5e2 against the now-merged ammonia upgrade.

No remaining blocking concerns found. The earlier title-spoof/content-loss finding is substantively fixed by conservative start-of-document front-matter splitting and body stripping before Markdown parsing, with regression coverage. The current head also adds no-JavaScript alert palette defaults, Windows-safe test imports, and changelog entries. The PR has been retargeted to main; fresh CI is running for that recalculated base.

codex-gpt-5.6-sol-medium on behalf of maphew

Resolve the changelog release-boundary conflict by keeping the new alert and front-matter entries under Unreleased while preserving the 0.6.1 notes from main.

Agent-Signature: codex-gpt-5.6-sol-medium on behalf of maphew
@maphew
maphew merged commit 0b8f05d into main Aug 23, 2026
3 checks passed
@maphew
maphew deleted the feature/mdo-4pm-1-markdown-upgrade branch August 23, 2026 18:15
maphew added a commit that referenced this pull request Aug 23, 2026
Integrate the current #37 head, including its merge from main, so this branch is compatible with the retargeted stack.

Agent-Signature: codex-gpt-5.6-sol-high on behalf of matt wilkie
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