Text formatting and semantics
Last updated
Last updated
MessageML supports the following tags for formatting content within a message:
Tag
Description
Optional attributes
<br/>
Insert a line break.
None.
<a href="url">
Link Text
</a>
Insert a hyperlink that will be displayed in the message.
<b>text</b>
Bold formatting.
Note: when receiving a message from an Agent that contains whitespace between the last character in a bolded section and the closing </b>
tag, the bold section will be returned in Markdown (i.e. surrounded by double '*' characters) instead of XHTML tags.
<i>text</i>
Italics formatting.
Note: when receiving a message from an Agent that contains whitespace between the last character in an italics-formatted section and the closing </i>
tag, the italics section will be returned in Markdown (i.e. surrounded by single '*' characters) instead of XHTML tags.
<pre>
preformatted text
</pre>
Preformatted text.
<span>text</span>
<code>code sample</code>
Format the text as a block of code.
language
: Use the language attribute to benefit from language specific code highlighting. The following languages are available: c, cpp, csharp, css, html, java, js, jsx, php, python, r, typescript, tsx, plaintext, yaml, scala, json, shell, markdown
Note: language
attribute is only available with Agent 20.14+.
Here after you can find an example of a message sent by a bot and containing these formatting and semantics tags as well as the structure of the messageML sent:
Main features introduced
Agent needed to parse message sent by the bot
Client 2.0 release
Backward client-compatibility behavior (e.g. external rooms)
Client 1.5 release
Initial release
Since the first version
Since the first version
-
Since the first version
Closing <b> and <i> without line breaks*
Since the first version
Since the first version
-
1.53
Support of the language attribute on <code> blocks.
Agent 20.14
Since the first version
-
• href
: the URL of the link
• class
: .
• class
: .
• class
: .
• class
: .
• Non-HTML MessageML are not supported inside <pre>
.
No formatting.
• This tag can be used to specify visual styles, by adding a class
attribute.
• This tag is used to create .
• class
: .
• data-entity-id
• See below for list of translated PresentationML attributes.
Note: please see escaping rules for when using code tag