fix(theme): suppress duplicate admonition icon when title contains emoji (#119, #17) - #211
Conversation
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@greptile review |
🚀 Preview DeploymentYour documentation preview is ready! Preview URL: https://pr-211.comapeo-docs-82j.pages.dev 📦 Content: from This preview will update automatically when you push new commits to this PR. Built with commit afb7747 |
209cab6 to
afb7747
Compare
|
@greptile review |
🧹 Preview Deployment CleanupThe preview deployment for this PR has been cleaned up. Preview URL was: Note: Cloudflare Pages deployments follow automatic retention policies. Old previews are cleaned up automatically. |
Summary
Fixes #119 (duplicate info/SVG icon appearing before emoji in Notion-converted callouts) and addresses #17 (dark mode styling and contrast for admonitions).
Problem
Notion callouts include an icon (often an emoji) alongside text. When converted to Docusaurus markdown (e.g.
:::note 💡 Tipor:::note 👣), Docusaurus's defaultAdmonitioncomponent prepends its own type SVG icon (such as the info circle) to the title bar, resulting in duplicated symbols:[SVG icon] 💡 Tip.Additionally, dark mode admonition styles in
src/css/custom.csslacked dedicated dark contrast definitions, making gray (note) and other callouts washed out on dark backgrounds.Solution
src/utils/admonitionEmoji.ts):\uFE0Fon⚠️and✔️), skin tone modifiers (👉🏽), regional indicator flags (🇧🇷), keycaps (1️⃣), and ZWJ sequences (👩💻).©,®, and™.src/theme/Admonition/index.tsx):@theme-original/Admonition.iconprop (<span className="admonition-emoji-icon">{emoji}</span>) and passes the clean remainder as thetitle.:::note 👣), renders only the emoji without extra fallback text.src/css/custom.css):.admonition-emoji-iconsizing, alignment, and spacing.[data-theme="dark"]admonition rules and icon fills for all callout types (note,tip,info,warning,danger,caution).src/utils/admonitionEmoji.test.tscovering simple emojis, skin tones, ZWJ sequences, flags, and negative cases.vitest.config.tsto includesrc/**test files.Fixes #119
Closes #17
Greptile Summary
The PR customizes Docusaurus admonitions to replace default type icons with leading title emoji, preserves emoji-only titles, adds light/dark callout styling, and expands Vitest discovery for source tests.
icon={null}.Confidence Score: 5/5
The PR appears safe to merge; no actionable new issue or outstanding previous finding remains.
The emoji-only path now passes a non-empty emoji title and suppresses only the default icon, fully addressing the previous finding. The subsequent CSS and parser changes preserve standard admonition behavior and existing test discovery.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Admonition title] --> B{String beginning with emoji?} B -->|No| C[Render original Admonition props] B -->|Yes| D[Split leading emoji] D --> E{Remaining title text?} E -->|Yes| F[Render emoji as icon and remainder as title] E -->|No| G[Render emoji as title with no default SVG]Reviews (2): Last reviewed commit: "fix(theme): suppress duplicate admonitio..." | Re-trigger Greptile
Context used (3)