Class RichTextUtils
Helpers to safely embed untrusted text inside UI Toolkit rich text.
Inherited Members
Namespace: Unity.AppUI.Core
Assembly: Unity.AppUI.dll
Syntax
public static class RichTextUtils
Methods
Escape(string)
Wraps untrusted text in a <noparse> region so that any formatting tag it
contains is displayed literally instead of being interpreted.
Declaration
public static string Escape(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The untrusted text. |
Returns
| Type | Description |
|---|---|
| string | Rich text that renders |
NeutralizeNoParse(string)
Neutralizes any </noparse> marker in text so it cannot
terminate an enclosing noparse region.
Declaration
public static string NeutralizeNoParse(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The untrusted text. |
Returns
| Type | Description |
|---|---|
| string | The text with every closing noparse marker broken. |
Remarks
UI Toolkit noparse regions do not nest and end at the first closing marker the parser sees, so an embedded marker would re-enable tag interpretation for the rest of the text.