Skip to content

feat(remark): add alert support#832

Merged
avivkeller merged 1 commit into
mainfrom
feat/alerts
Jun 9, 2026
Merged

feat(remark): add alert support#832
avivkeller merged 1 commit into
mainfrom
feat/alerts

Conversation

@avivkeller

Copy link
Copy Markdown
Member

Fixes #831:

image

@avivkeller avivkeller requested a review from a team as a code owner June 6, 2026 20:18
@cursor

cursor Bot commented Jun 6, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Markdown-to-JSX presentation change with targeted tests; only affects blockquotes that match GitHub alert syntax.

Overview
Adds GitHub-flavored alert blockquotes (> [!NOTE], [!TIP], etc.) to the JSX doc generation pipeline so they render as AlertBox components instead of plain blockquotes.

A new remark plugin (transformAlerts) runs early in getRemarkRecma, detects alert markers on the first paragraph of a blockquote, strips the marker line, maps keywords to level/title (e.g. NOTE → neutral, CAUTION → danger), and emits block-level MDX AlertBox nodes. Shared constants add NEUTRAL, GITHUB_ALERT_TYPES, and an ALERT_MARKER regex. The existing HAST element transformer is relocated under utils/plugins/ with an updated import path only.

Unit tests cover all five GitHub alert types, body preservation, marker-only paragraphs, and passthrough for normal quotes and unknown markers.

Reviewed by Cursor Bugbot for commit 7818956. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Jun 6, 2026 8:20pm

Request Review

@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.79144% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.48%. Comparing base (6b1b38f) to head (7818956).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/generators/jsx-ast/utils/plugins/alerts.mjs 91.89% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #832      +/-   ##
==========================================
+ Coverage   84.34%   84.48%   +0.14%     
==========================================
  Files         172      174       +2     
  Lines       15447    15632     +185     
  Branches     1368     1386      +18     
==========================================
+ Hits        13028    13207     +179     
- Misses       2409     2415       +6     
  Partials       10       10              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds native support for GitHub-style Markdown alerts (> [!NOTE], > [!WARNING], etc.) in the JSX/Recma rendering pipeline by rewriting matching blockquotes into AlertBox MDX JSX elements.

Changes:

  • Add a Remark plugin that detects GitHub alert markers in blockquotes and converts them into AlertBox components.
  • Wire the new alert transform into the getRemarkRecma unified pipeline used for JSX generation.
  • Extend JSX-AST constants with GitHub alert mappings + marker regex and add focused unit tests for both the new alerts plugin and the existing transformer behavior.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/utils/remark.mjs Registers the new alert transform in the Recma/JSX unified pipeline and updates transformer import path.
src/generators/jsx-ast/utils/plugins/transformer.mjs Adjusts constants import path after relocating transformer into the plugins/ directory.
src/generators/jsx-ast/utils/plugins/alerts.mjs New Remark plugin converting > [!…] alert blockquotes into AlertBox MDX JSX elements.
src/generators/jsx-ast/utils/plugins/tests/transformer.test.mjs Adds a unit test covering the footnotes relocation behavior in the transformer plugin.
src/generators/jsx-ast/utils/plugins/tests/alerts.test.mjs Adds unit tests validating alert marker detection, mapping, and marker stripping behavior.
src/generators/jsx-ast/constants.mjs Adds NEUTRAL level and defines GitHub alert keyword → AlertBox level mapping + marker regex.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@avivkeller avivkeller merged commit 5fbf141 into main Jun 9, 2026
26 checks passed
@avivkeller avivkeller deleted the feat/alerts branch June 9, 2026 22:29
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.

feat: Add support for GitHub Alerts natively

4 participants