| Net::Async::Matrix::Utils(3pm) | User Contributed Perl Documentation | Net::Async::Matrix::Utils(3pm) |
"Net::Async::Matrix::Utils" - support utilities for Net::Async::Matrix
$st = parse_formatted_message( $content )
Given the content of a "m.room.message" event of "m.text" or "m.emote" type, returns a String::Tagged instance containing the text of the message with formatting in String::Tagged::Formatting style. If the message is not formatted, or the formatting is of a kind not recognised, the plain-text body is returned in an instance with no tags.
The following formats are recognised:
HTML | String::Tagged::Formatting
------------------+---------------------------
<b>, <strong> | 'bold'
<i>, <em> | 'italic'
<u> | 'under'
<strike> | 'strike'
<tt>, <code> | 'monospace'
<font color="..." | 'fg'
$content = build_formatted_message( $str )
Given a String::Tagged::Formatting instance or plain string, returns a content HASH reference encoding the formatting the message. Plain strings are returned simply as a plain-text body; formatted instances will be output as formatted content if possible:
String::Tagged::Formatting | HTML
---------------------------+--------------------
'bold' | <strong>
'italic' | <em>
'under' | <u>
'strike' | <strike>
'monospace' | <code>
'fg' | <font color="...">
Paul Evans <leonerd@leonerd.org.uk>
| 2022-12-10 | perl v5.36.0 |