Skip to main content

Tips and Best Practices

For AI/LLM Output

If you're displaying text from AI providers (Grok, ChatGPT, Claude, Gemini):

  • Always use Convert and Sanitize Markdown (the combined function) rather than converting and sanitizing separately. This ensures Unicode symbols are handled correctly in the final output.
  • AI providers frequently use emoji and Unicode symbols that most UE fonts don't support. The sanitizer covers 100+ common symbols, but some rare characters may still appear as boxes. If you encounter this, the character can be added to the sanitizer's mapping table.
  • Different providers format differently. The parser handles all common patterns, but you'll get the best results by including formatting instructions in your prompts or system messages.

For Custom UIs

  • Use AzimuthRichTextBlock instead of the standard URichTextBlock when possible. It uses a custom markup parser that correctly propagates tag names to decorators, avoiding edge cases with UE's default parser.
  • If you need both rich text and plain text versions of the same content, parse once and render twice:
TArray<FMarkdownBlock> AST = FAzimuthMarkdownParser::Parse(Input);
FString Rich = FAzimuthMarkdownRenderer::RenderToTaggedText(AST, GetDefaultAzimuthTagMapping());
FString Plain = FAzimuthMarkdownRenderer::RenderToPlainText(AST);
  • Keep your DataTable rows consistent. If a row name is missing, the decorator falls back to the Default row. This won't crash, but the text won't have the intended style.

Performance

  • Parsing and rendering are fast -- typically under 1ms even for large documents. There is no need to cache results unless you're re-rendering the same content hundreds of times per frame.
  • The Unicode sanitizer uses ReplaceInline for efficiency. It modifies the string in place rather than creating copies.
  • The plugin uses lazy initialization. No work is done until you call a function.