Module formatting

Module formatting 

Source
Expand description

Text formatting for emoji and markdown processing.

This module provides transformation of ASCII emoticons to Unicode emoji and basic markdown formatting (bold, italic, code) with Ratatui styling.

ยงSupported ASCII Emoticons

The following ASCII emoticons are automatically converted to Unicode emoji:

ASCIIEmojiDescription
(y)๐Ÿ‘Thumbs up
:-)๐Ÿ˜ŠSmile
:)๐Ÿ™‚Simple smile
:-D๐Ÿ˜„Grin
:D๐Ÿ˜„Grin
;-)๐Ÿ˜‰Wink
;)๐Ÿ˜‰Wink
:-P๐Ÿ˜›Tongue
:P๐Ÿ˜›Tongue
:-(๐Ÿ˜žSad
:(๐Ÿ˜žSad
:/๐Ÿ˜•Unsure
:o๐Ÿ˜ฎSurprised
:O๐Ÿ˜ฎSurprised
:*๐Ÿ˜˜Kiss
:|๐Ÿ˜Neutral
:Q๐Ÿ‘ถBaby face

ยงMarkdown Formatting

  • *bold text* - Renders in bold
  • _italic text_ - Renders in italic
  • `code` - Renders with code styling (reversed video)

Important: Content within backticks is treated as verbatim text. No emoji replacement, bold, or italic formatting will be applied inside backtick pairs. For example:

  • `*not bold*` - The asterisks remain literal
  • `:) no emoji` - The emoticon remains as :)

Processing order ensures backticks are handled first, protecting their content from all subsequent transformations.

Enumsยง

Segment ๐Ÿ”’
Text segment type after processing backticks

Constantsยง

EMOJI_MAP ๐Ÿ”’
Emoji replacement mappings (ASCII -> Unicode)

Functionsยง

process_backticks ๐Ÿ”’
Process backticks and return segments.
process_delimiter ๐Ÿ”’
Process a single delimiter pattern (like * or _) in text.
process_markdown ๐Ÿ”’
Process markdown formatting (bold and italic) in text.
process_text
Process text with emoji and markdown formatting.
replace_emoji ๐Ÿ”’
Replace ASCII emoticons with Unicode emoji.