Skip to content

Render GitHub alert blockquotes - #418

Open
yusufm wants to merge 1 commit into
schuyler:mainfrom
yusufm:Codex/render-github-alert-blockquotes-019def52-b3da-7962-96cd-afa05d8d1592
Open

Render GitHub alert blockquotes#418
yusufm wants to merge 1 commit into
schuyler:mainfrom
yusufm:Codex/render-github-alert-blockquotes-019def52-b3da-7962-96cd-afa05d8d1592

Conversation

@yusufm

@yusufm yusufm commented May 3, 2026

Copy link
Copy Markdown
Contributor

Related to #291

Summary

  • Convert GitHub-style blockquote alerts into semantic alert containers after Markdown rendering
  • Add bundled alert CSS for preview and styled HTML export
  • Add renderer tests for alert conversion and ordinary blockquotes

Tests

  • xcodebuild test -workspace 'MacDown 3000.xcworkspace' -scheme MacDown -destination 'platform=macOS' -only-testing:MacDownTests/MPRendererEdgeCaseTests/testRendererFormatsGitHubAlertBlockquote -only-testing:MacDownTests/MPRendererEdgeCaseTests/testRendererLeavesNormalBlockquoteAlone -only-testing:MacDownTests/MPRendererEdgeCaseTests/testPreviewRenderIncludesContentSecurityPolicyAndCheckboxToken

@schuyler schuyler left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the PR, @yusufm!

Issues

  • Nested blockquotes: an alert containing a nested > > quote makes the regex stop at the inner </blockquote>, leaving a dangling outer tag and malformed HTML.
  • Single-type test coverage: only WARNING is exercised, so a typo in any of the NOTE/TIP/IMPORTANT/CAUTION class or title mappings would go uncaught.
  • Case-insensitivity untested: the case-insensitive flag (which supports [!note]) has no test guarding it against a silent regression.

Suggestions

  • A regression test confirming an alert marker inside a fenced code block stays unconverted would guard against the regex becoming too greedy.
  • A multi-paragraph alert body test would document the expected behavior and protect the body-capture logic.
  • Gating the transform and its stylesheet behind an MPRendererDataSource flag (as other renderer features are) would keep the architecture consistent, though it could also land as a follow-up.
  • An NSAssert after the regex compile would surface a pattern failure during development rather than silently turning the transform into a no-op.

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