feat: emoji shortcodes as an optional inline pass (./inline/emoji) - #91
Merged
Conversation
Promote the EXTENDING.md emoji recipe (#86) to a shipped, optional inline pass behind the `@copse/streaming-markdown/inline/emoji` subpath. It maps `:shortcode:` to emoji via a GitHub/gemoji-aligned table (1913 aliases) so `:shortcode:`s an LLM emits resolve to the glyph GitHub would render. Built entirely on the public `setInlinePasses` contract, so it needs no core registry and adds zero bytes to the main bundle unless imported (an esbuild bundle assertion pins this). The pass obeys the full inline-pass contract for free: `` `:smile:` `` and `\:smile:` stay literal, unknown codes pass through, and a `holdStart` suppresses a half-typed `:smi` mid stream. `createEmojiInlinePass(map)` lets a host extend/replace the table; lookups go through a Map to close a prototype-pollution hole (`:constructor:` stays literal). Docs: EXTENDING.md inline-pass section now points at the built-in pass, plus a LAZY-LOADING.md subsection and a README mention. Coverage ratchet raised 99.75% -> 99.79%. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ehmok4AzyTQDNkRzW3g8z8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #86.
Promotes the EXTENDING.md emoji recipe to a shipped, optional inline pass behind
@copse/streaming-markdown/inline/emoji— off by default, zero bytes in the main bundle unless imported (asserted in-test by bundlingindex.tswith esbuild and checking a glyph is absent).What's in here
src/emoji-shortcodes.ts—emojiInlinePass,createEmojiInlinePass(map?)factory, re-exportedemojiShortcodesmap. Built purely on the publicsetInlinePassescontract — no core registry added (unlike highlight/mermaid/katex).src/emoji-shortcode-map.ts— 1913 gemoji aliases → emoji, generated fromgithub/gemoji, living only in the lazy module (~50 KB on that chunk, never the main bundle).<code>/<a>/<img>, respects\:smile:, unknown shortcodes pass through literally,holdStartprevents mid-stream:smiflash.API decisions
before-linksso emoji render inside link labels ([go :rocket:](url)).createEmojiInlinePass(customMap)for host extension;emojiShortcodesre-exported for inspection.Mapbuilt from the object, so:constructor:/:tostring:(valid shortcode shape, inherited keys) stay literal instead of emitting[object …]/ function source.holdStartexempts a bare trailing colon so prose likeSteps:/Note:never flickers; it only holds when ≥1 shortcode char follows (:smi). Consequence: a trailing:wordrun at EOL transiently holds until the next token — same self-resolving transient as the existing citation/strikethrough passes; no effect at rest.Verification
npm run typecheck,npm run build(dist/emoji-shortcodes.*emitted) — passnpm test— 785 tests, 783 pass, 0 fail, 2 skip (incl. 17 emoji tests + the bundle-isolation assertion)npm run check:conformance/npm run check:gfm-conformance— 2/2npm run coverage:ci— 99.79% (baseline ratcheted up from 99.75)Caveats
master; a maintainer refresh script could follow but wasn't in scope.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ehmok4AzyTQDNkRzW3g8z8
Generated by Claude Code