configuration:
- target_file:
quartz/plugins/transformers/emoji.ts
plugin:
- type:
QuartzTransformerPlugin - phase:
htmlPlugins - specification:
rehype
behavior:
- mechanism: map standard emojis to matching icons using
unist-util-visitfor AST traversal - identification: use
emoji-regexto accurately capture full grapheme clusters and ZWJ sequences - optimization: use base64 image data or inline SVG to eliminate external network requests
hooks:
- ast_traversal:
- utility:
unist-util-visit - target: walk
textnodes in the hast tree - filters:
- check_parents: ensure no ancestor element has a
tagNameofcodeorpre - ignore_context: skip if parent is an attribute node or non-renderable element
- check_parents: ensure no ancestor element has a
- utility:
- transformation:
- step_1: match valid emojis via regex within the text node value
- step_2: pass the matched literal emoji character to the
getIconCode(char)utility inquartz/util/emoji.ts - step_3: retrieve the graphic data using
loadEmoji(code)or an equivalent map - step_4: construct a new hast
elementnode mapping to<img className="emoji"> - step_5: split the original text node and insert the fragments and new icon node into the parent children array
replacement_schema:
- type:
element - tagName:
img - properties:
- className:
emoji
- src: base64 data string
- alt: literal emoji character
- className: