Class HtmlText
Renders the HTML formatted_body of a message as terminal text: paragraphs, lists, quotes, code, links and mention names.
Inherited Members
Namespace: Uniform.Matrix.Client.Formatting
Assembly: Uniform.Matrix.Client.dll
Syntax
public static class HtmlText
Remarks
Emphasis becomes bold, italic and ~strike~, as the log has one color per line. Reply fallbacks (mx-reply) are dropped and spoilers hidden.
Methods
| Edit this page View SourceToText(string, Func<string, string?>?)
Convert html to text.
Declaration
public static string ToText(string html, Func<string, string?>? userName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | html | Formatted body. |
| Func<string, string> | userName | Returns the display name for a mentioned user ID; mention pills show their link text when null. |
Returns
| Type | Description |
|---|---|
| string |
Examples
HtmlText.ToText("<p>Hi <strong>all</strong></p><ul><li>one</li></ul>"); // "Hi *all*\n• one"