MCPcopy
hub / github.com/npmx-dev/npmx.dev / convertToEmoji

Function convertToEmoji

shared/utils/emoji.ts:1908–1920  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

1906}
1907
1908export function convertToEmoji(html: string): string {
1909 return html.replace(
1910 /(<code[\s>][\s\S]*?<\/code>|<pre[\s>][\s\S]*?<\/pre>)|(:[\w+-]+:)/gi,
1911 (match, codeBlock: string | undefined, shortcode: string | undefined) => {
1912 if (codeBlock) return codeBlock
1913 if (shortcode) {
1914 const key = shortcode.slice(1, -1)
1915 return emojis[key] ?? shortcode
1916 }
1917 return match
1918 },
1919 )
1920}

Callers 3

emoji.spec.tsFile · 0.90
renderReadmeHtmlFunction · 0.90
changelogRendererFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected