First draft.
Historically, XMPP has had no system for simple text styling. Instead, specifications like &xep0071; that require full layout engines have been used, leading to numerous security issues with implementations. Some clients have also performed their own formatting based on identifiers in the body. While this has worked well for those clients, it is not interoperable and leads to clients each supporting their own informal styling languages.
This specification aims to provide a single, interoperable text styling language that can be used by entities that do not require full layout engines.
Many important terms used in this document are defined in &unicode;. The terms "left-to-right" (LTR) and "right-to-left" (RTL) are defined in &uax9;.
If an entity supports this specification it MUST advertise the fact by returning a feature of 'urn:xmpp:styling:0' &VNOTE; in response to a &xep0030; information request (or by advertising this namespace in the dynamic profile of service discovery defined in &xep0115;).
An entity supporting this specification SHOULD render all messages <body> elements using this specification and MAY choose to send messages formatted using this specification even if the other end has not advertised support.
Formatting characters MAY be displayed styled along with the span they apply to or they may be hidden and the styling only applied to the span. For instance, given the string "*emphasis*" both of the following are valid renderings:
Examples in this document will display the formatting characters for clarity.
Inline styling directives are evaluated lazily from the start of the byte stream (the left in left-to-right languages and the right in right-to-left languages). Matches MUST NOT extend over newlines and MUST start with a whitespace character or be the beginning of the line or the byte stream. Matches MUST contain some text between the two styling directives. Inline styling directives may also be doubled to allow the single character version of the directive to be styled. That is to say, "**emphasis**" is rendered the same as "*emphasis*". For example, the word "emphasized" would be styled in each of the following messages:
Nothing would be formatted in the following messages (where / represents a new line):
Block level styling such as preformatted blocks and quotations is always handled before inlines such as emphasis and inline preformatted text.
Text enclosed by '*' (U+002A ASTERISK) MUST be displayed with a greater weight than the surrounding text (bold face).