Markdown in Unity Text: Bold, Links and Lists Without Conversion

Last reviewed

Short answer

Neither TextMesh Pro nor UI Toolkit reads Markdown: **bold** shows up with its asterisks. The usual fixes convert Markdown to rich-text tags before display, or render each Markdown block as a separate UI object.

UniText reads inline Markdown directly in any text: bold, italic, strikethrough, underline, links, lists, code spans and backslash escapes, alongside its own tags. Copy and paste carry the formatting as Markdown or HTML.

The usual options

  • Convert to rich text. FancyTextRendering and similar tools turn Markdown into TextMesh Pro tags before display: headings, bold, italic, strikethrough, monospace, lists and links in one text object. The string shown is the converted one, so editing and copying work on tags, not on Markdown.
  • One element per block. Markdig-based renderers for UI Toolkit, such as Markdown Support, build headings, paragraphs, tables, code blocks and images as separate visual elements. They cover more of the Markdown specification and suit document views in UI Toolkit.
  • Editor only. UnityMarkdownViewer renders Markdown files in the Unity Editor for documentation, not in a game.

Markdown in UniText

SyntaxResult
**bold**bold
*italic*italic
~~strike~~strikethrough
++underline++underline
[text](url)a clickable link
- item, 1. itembulleted and numbered lists
`code`a code span whose content is not parsed
\*a literal asterisk
  • Markdown markers are rules in the component's style list, like tags. Each marker can be switched on or off, and the effect it applies can be changed, so ** could mean a color instead of bold.
  • Bare URLs, @mentions and #tags can be detected automatically and made clickable.
  • In editable text, copying produces Markdown and HTML along with plain text, and pasting formatted text from other apps keeps its formatting.
  • Formatting works the same way in every script and inside right-to-left text.

UniText covers inline Markdown and lists. Headings, tables, block quotes and fenced code blocks are not among its Markdown rules; sizes, spacing and layout come from UniText's own tags instead.

Questions

Can I mix Markdown and rich-text tags?

Yes. Markdown markers and tags are both rules feeding the same styles, so **bold** and <color=red>red</color> work in one string.

Will an asterisk in a player's message break the formatting?

A single asterisk without a closing one stays literal, a backslash escapes any marker, and text between backticks is never parsed. Rules can also be removed for text that should never be formatted.

Check it in your project

Run the browser demo, follow the setup guide, or compare the free version with the licenses.

Related problems