# Markdown with Caplin extensions

As of FX Professional 5.7.0 and FX Sales 3.16.0, some trade model message fields support Markdown formatting.

## Overview

As of FX Professional 5.7.0 and FX Sales 3.16.0, the following message fields support Markdown content as a richer alternative to plain text:

* `WarningMessage`
* `DetailedWarningMessage`

## Markdown flavor

Syntax support:

* GitHub Flavor Markdown (GFM) lists
* GFM task lists
* HTML
* [Caplin substitution tokens](#caplin-substitution-tokens)

## Caplin substitution tokens

You can use the following substitution tokens in Markdown or plain text content:

* [Theme tokens](#theme-tokens)
* [i18n tokens](#i18n-tokens)

### Theme tokens

The front end application replaces theme tokens with a colour from the active theme file.

**Syntax:** `{{theme:__identifier__}}`

**Example:** `{{theme:foreground.semantic.warning_inverse}}`

**Setting a theme colour in an HTML span tag**

```html
<span style="color: {{theme:foreground.semantic.warning_inverse}}">Unfortunately we are unable to quote a rate for this amount at this time. Please contact your dealer during their normal business hours.</span>
```

### i18n tokens

The front end application replaces i18n tokens with a value from the i18n properties file for the active locale. The front end additionally supports interpolating optional arguments into the i18n token value.

**Syntax:** `{{i18n:__identifier__}}`

**Example:** `{{i18n:fx-margin-ticket.warningcode.123}}`

**Example (with arguments):** `{{i18n:label.client.sell|{"dealtCurrency":"GBP"}}}`

As of FX Professional 6.1.0 and FX Sales 4.0.0, parameters in i18n token values (`[__parameter__]`) are interpolated. For example, given the following i18n token value …

```
caplin.fx.validation.invalid_decimals=Only [decimalPlaces] decimal places are allowed
```

… the string `{{i18n:caplin.fx.validation.invalid_decimals|{"decimalPlaces":"2"}}}` is rendered with the parameter token `[decimalPlaces]` interpolated:

```
Only 2 decimal places are allowed
```

As of FX Professional 6.1.0 and FX Sales 4.0.0, the front end application supports the ability to interpolate and format date times received in ISO format. The following custom date formatters are supported:

| Formatter | Format |
| --- | --- |
| iso-date | DD/MM/YYYY |
| iso-time-seconds | HH:mm:ss |
| iso-datetime-seconds | DD/MM/YYYY - HH:mm:ss |
| iso-datetime-minutes | DD/MM/YYYY - HH:mm |

For example, given the following i18n token value …

```
example.token=Trading is not available between [startTime, iso-datetime-minutes] and [endTime, iso-datetime-minutes].
```

the string `{{i18n:example.token|{"startTime": "2026-01-17T09:00:00.000000", endTime: "2026-01-17T11:00:00.000000"}}` is rendered as follows:

```
Trading is not available between 17/01/2026 - 09:00 and 17/01/2026 - 11:00.
```

## Text alignment

In versions prior to FX Professional 5.14 and FX Sales 3.27, content is centre-aligned by default.

From FX Professional 5.14 and FX Sales 3.27, content is left-aligned by default.

To override the default alignment, use inline styling. For example, to centre align text in FX Professional 5.14 or higher, use the markup below:

**Using a div tag with inline styling to centre align text.**

```html
<div style="text-align: center">This text will be aligned to the centre of the markdown component.</div>
```
