Using Markdown in messages
Last updated
Last updated
In order to add richness and enhance our end users' experience when using the WebChat interface, it is possible to use Markdown within message types that have a significant text component. The currently supported message types are: Text, Button, Form and Rich. OpenDialog supports all the basic features of the Markdown syntax, as well as tables and fenced code blocks.
In addition to providing Markdown support, OpenDialog also supports the use of Markdown attributes within WebChat. This allows designers to add their own classes and IDs to elements within the message content so that they can be styled later using external CSS. To avoid any security concerns, only a limited set of HTML attributes will be accepted; these are:
To specify a custom class & ID for an element, use the following syntax:
For classes and IDs, use .
and #
respectively, for the other supported attributes you can use the following syntax:
Occasionally there may be some ambiguity over which element the attribute should be applied to. In the case of the list below for example, we can solve this using the placement of the attribute markdown:
For more information, you can check out the documentation here, but be aware that in OpenDialog we use [[ ]]
to denote an attribute, NOT { }
as used in the above link.
WebChat will add syntax highlighting to fenced code blocks so that code examples are easier to read for users. If no language is supplied, it will attempt to detect the language and highlight appropriately, however you can also specify the language using the following syntax (note the language name at the end of the first 'fence'):