Skip to content

fix: convert emoji in markdown text tokens#3037

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

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

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jul 13, 2026 4:39am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jul 13, 2026 4:39am
npmx-lunaria Ignored Ignored Jul 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

coderabbitai Bot 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 name Status Explanation
Linked Issues check ✅ Passed The PR satisfies #2822 by moving emoji conversion into the text renderer so code paths bypass it naturally.
Out of Scope Changes check ✅ Passed No clear unrelated changes are present; the slug and test updates support the emoji-rendering refactor.
Title check ✅ Passed It concisely describes the main change: emoji conversion now happens in Markdown text tokens.
Description check ✅ Passed The description matches the PR's core change and testing notes, including moving emoji conversion into the marked text renderer.
✨ 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

codecov Bot 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 lines Patch % Lines
server/utils/mdKit.ts 36.36% 1 Missing and 6 partials ⚠️
shared/utils/emoji.ts 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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

@gameroman gameroman 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review This PR is waiting for a review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip emoji conversion without regex

3 participants