Skip to content

fix: convert emoji in markdown text tokens - #3037

Closed
Semak12345 wants to merge 2 commits into
npmx-dev:mainfrom
Semak12345:fix/emoji-text-renderer
Closed

fix: convert emoji in markdown text tokens#3037
Semak12345 wants to merge 2 commits into
npmx-dev:mainfrom
Semak12345:fix/emoji-text-renderer

Conversation

@Semak12345

Copy link
Copy Markdown

Closes#2822

Moves emoji conversion into the marked text renderer instead of scanning rendered HTML for code tags. Inline code, fenced code, and escaped shortcodes now bypass conversion naturally. Shortcode-based heading anchors remain unchanged.

Tested with:

  • 109 targeted unit tests
  • formatter and lint
  • full workspace typecheck

@vercel

vercelBot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
npmx.devReadyReadyPreview, CommentJul 13, 2026 4:39am
2 Skipped Deployments
ProjectDeploymentActionsUpdated (UTC)
docs.npmx.devIgnoredIgnoredPreviewJul 13, 2026 4:39am
npmx-lunariaIgnoredIgnoredJul 13, 2026 4:39am

Request Review

@github-actions

Copy link
Copy Markdown

Hello! Thank you for opening your first PR to npmx, @Semak12345! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@coderabbitai

coderabbitaiBot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Emoji rendering and heading slugs

Layer / File(s)Summary
Token-aware Markdown rendering
server/utils/mdKit.ts, shared/utils/emoji.ts
Adds Marked text-token emoji rendering, token-based heading slug extraction, and plain-text shortcode conversion with unknown shortcode preservation.
README and changelog integration
server/utils/readme.ts, server/utils/changelog/markdown.ts
Moves emoji conversion into the Marked rendering pipeline and sanitises rendered HTML directly.
Emoji and heading rendering tests
test/unit/server/utils/readme.spec.ts, test/unit/server/utils/changelog/markdown.spec.ts, test/unit/shared/utils/emoji.spec.ts
Verifies conversion in normal text, preservation inside inline code, unknown shortcode handling, and README heading anchor generation.

Sequence Diagram(s)

sequenceDiagram
participant MarkdownInput
participant MarkdownRenderer
participant emojiText
participant Sanitizer
MarkdownInput->>MarkdownRenderer: render markdown tokens
MarkdownRenderer->>emojiText: process text tokens
emojiText-->>MarkdownRenderer: return rendered emoji text
MarkdownRenderer->>Sanitizer: sanitise rendered HTML
Sanitizer-->>MarkdownRenderer: return sanitised HTML
Loading

Possibly related PRs

Suggested reviewers:ghostdevv, gameroman

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedThe PR satisfies #2822 by moving emoji conversion into the text renderer so code paths bypass it naturally.
Out of Scope Changes check✅ PassedNo clear unrelated changes are present; the slug and test updates support the emoji-rendering refactor.
Title check✅ PassedThe title clearly summarises the main change: emoji conversion now occurs in Markdown text tokens.
Description check✅ PassedThe description explains the emoji-rendering change, code-path behaviour, linked issue, and validation performed.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecovBot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing linesPatch %Lines
server/utils/mdKit.ts36.36%1 Missing and 6 partials ⚠️
shared/utils/emoji.ts0.00%0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@graphierosgraphieros added the needs review This PR is waiting for a review from a maintainer label Jul 13, 2026

@gameromangameroman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use the pull request template

@gameromangameroman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please follow the PR template

@gameromangameroman added 007 This PR *may* not follow our code of conduct regarding AI usage. and removed needs review This PR is waiting for a review from a maintainer labels Aug 12, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

007This PR *may* not follow our code of conduct regarding AI usage.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip emoji conversion without regex

3 participants

@Semak12345@gameroman@graphieros