Text formatting

Trackmania styles text with codes that start with $. TextFormatter reads them by the same rules as the parser of the game, and turns the text into plain text, HTML, or ANSI for terminals.

Playground

<FormattedText>

BigBang1112

TextFormatter.Deformat

 BigBang1112 

TextFormatter.FormatHtml

<span style="color:#fc0;text-shadow:1px 1px 2px black"><span class="tm-icon"></span> </span><span style="color:#fff;font-weight:bold;text-shadow:1px 1px 2px black">Big</span><span style="color:#0af;font-weight:bold;text-shadow:1px 1px 2px black">Bang</span><span style="color:#fc0;font-weight:bold;text-shadow:1px 1px 2px black">1112</span> <span style="color:#f44"><span class="tm-icon"></span></span>

TextFormatter.FormatAnsi

\e[93m \e[97mBig\e[96mBang\e[93m1112\e[39m\e[22m \e[91m\e[39m\e[22m

Icons

The game shows the characters U+F000 to U+F2E0 as Font Awesome 4.7 icons. FormattedText wraps them in <span class="tm-icon">, which the stylesheet of TmEssentials.Razor displays with the icon font.

user U+F007
users U+F0C0
trophy U+F091
flag-checkered U+F11E
clock-o U+F017
car U+F1B9
gamepad U+F11B
star U+F005
heart U+F004
fire U+F06D
bolt U+F0E7
rocket U+F135
globe U+F0AC
music U+F001
camera U+F030
lock U+F023
check U+F00C
times U+F00D
arrow-up U+F062
arrow-down U+F063

Use the stylesheet

<link rel="stylesheet" href="_content/TmEssentials.Razor/tm-essentials.css" />

Or keep your own Font Awesome 4.7 stylesheet with IconCssClass="fa", or turn the wrapping off with IconCssClass="@null".

Platform icons

The game also has icons for platforms at U+F7AE to U+F7B2 (PlayStation, Ubisoft, Stadia, Xbox, Luna). They come from the font of the game and are not part of Font Awesome, so they are left as they are.

An unhandled error has occurred. Reload 🗙