NAME

Net::Async::Matrix::Utils - support utilities for Net::Async::Matrix

DESCRIPTION

FUNCTIONS

$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:

org.matrix.custom.html

This format requires the presence of HTML::TreeBuilder to parse; it will be ignored if this module is not available.

$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:

org.matrix.custom.html

This format is output for formatted messages if String::Tagged::HTML is available.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>