Repository navigation
feat(markdown): render GitHub-style callouts - #26255
Conversation
📝 WalkthroughWalkthroughThe change adds a remark plugin that recognizes supported GitHub callout markers in blockquotes and preserves their metadata through sanitization. Markdown previews and comment renderers display recognized callouts with kind-specific icons, labels, and styling. The change also adds export and preview styles, translations in six locales, and tests for supported markers and cases that remain ordinary blockquotes. Priority: ⬇️ Low 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 8 files. (8 skipped: 8 unsupported.) Full details: Description checkExplanation The description explains the user impact, implementation, rationale, testing, visual proof, compatibility considerations, and checklist items. It does not include the required linked issue, and it does not state AI usage or non-usage for an external contribution. Resolution Add an actual linked issue under “Linked Issue” using
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
05e1fc7b-9b48-40a1-8602-a4ef38e10d0c
📒 Files selected for processing (16)
src/renderer/src/assets/main.csssrc/renderer/src/assets/markdown-preview.csssrc/renderer/src/components/editor/export-css.tssrc/renderer/src/components/editor/markdown-preview-plugins.tssrc/renderer/src/components/editor/use-markdown-preview-components.tsxsrc/renderer/src/components/markdown-github-callout.tsxsrc/renderer/src/components/sidebar/CommentMarkdown.github-callout.test.tsxsrc/renderer/src/components/sidebar/CommentMarkdown.tsxsrc/renderer/src/components/sidebar/comment-markdown-element-renderers.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/remark-github-callouts.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| } else if (match[0].endsWith('\n') || paragraph.children.length === 1) { | ||
| paragraph.children.shift() | ||
| if (paragraph.children.length === 0) { | ||
| node.children.shift() | ||
| } | ||
| } else { | ||
| // `[!NOTE]*aside*`: an inline sibling shares the marker's line. | ||
| return |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Accept a hard break after a standalone marker.
For > [!NOTE] \n> Body, mdast puts a break node after the marker text. This branch treats that sibling as same-line content and leaves the marker visible in an ordinary quote. Check whether the next sibling is a line break before rejecting inline siblings; keep > [!NOTE]*aside* as an ordinary quote. (github.com)
|
Amazing |
ELI5
Agents often write notes like this:
GitHub shows that as a coloured box titled "Note". Orca showed it as a plain quote with the text
[!NOTE]at the top. Now Orca shows the coloured, titled box too.What Changed
Before: a quote starting with
[!NOTE],[!TIP],[!IMPORTANT],[!WARNING]or[!CAUTION]rendered as an ordinary grey quote with the marker left in as literal text.After: it renders as a callout with a coloured left border, an icon and a title ("Note", "Tip", "Important", "Warning", "Caution"), and the marker line is gone. This applies everywhere Orca renders markdown read-only:
Mechanism: these callouts are a GitHub extension, not part of standard GitHub-flavoured markdown, so the markdown parser leaves the marker as text. A small parser plugin now looks at each quote: if its first line is exactly one of the five markers, it removes that line and tags the quote with the callout kind. The quote renderers check for that tag and draw a shared callout component instead of a quote. Both HTML sanitizers allow the tag, limited to the five known kinds.
As on GitHub, a marker that shares its line with other text (
> [!NOTE] some text) and unknown markers (> [!DANGER]) stay ordinary quotes.Titles are translated in all six languages. Tip, warning and caution reuse the existing success, warning and destructive colours. Note and important had no matching colour, so this adds two tokens for them (GitHub's blue and purple, light and dark).
Not changed: the rich (WYSIWYG) markdown editor still shows the marker as text, so editing a file never rewrites it.
Why
Agents use these callouts to flag the part of a reply that matters most. Rendering them as a quote with a stray
[!IMPORTANT]in front made that part look like noise.Visual Proof
Before:

After:

Testing
New tests render markdown through the real chat, comment and preview pipelines and cover: all three surfaces, a marker followed by a blank line and more blocks, a body that starts with bold text, and the three cases that must stay plain quotes. The export styles are not covered by a test.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)