diff --git a/inbox/styling.xml b/inbox/styling.xml new file mode 100644 index 00000000..dec636ec --- /dev/null +++ b/inbox/styling.xml @@ -0,0 +1,367 @@ + + +%ents; +RFC 7764 RFC 7764: Guidance on Markdown: Design Philosophies, Stability Strategies, and Select Registrations <http://tools.ietf.org/html/rfc7764>." > +Unicode Standard Annex #9 Unicode Standard Annex #9, "Unicode Bidirectional Algorithm", edited by Mark Davis, Aharon Lanin, and Andrew Glass. An integral part of The Unicode Standard, <http://unicode.org/reports/tr9/>." > +]> + + +
+ Message Styling + + This specification defines a plain-text formatting syntax for use in + exchanging instant messages with simple text styling. + + &LEGALNOTICE; + xxxx + ProtoXEP + Standards Track + Standards + Council + + XMPP Core + XEP-0001 + + + + styling + &sam; + + 0.0.1 + 2017-10-28 + ssw +

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;. +

+
+ +
Formal markup language
+
+ A structured markup language such as LaTeX, SGML, HTML, or XML that is + formally defined and may include metadata unrelated to formatting or + text style. +
+
+ +
Formatted text
+
+ Text that includes non-textual information coded in a particular way + that affects the interpretation of the text by computer programs + (&rfc7764;). +
+
+ +
Plain text
+
+ Text that does not convey any particular formatting or interpretation of + the text by computer programs. +
+
+ +
Whitespace character
+
+ Any Unicode scalar value which has the property "White_Space" or is in + category Z in the Unicode Character Database. +
+
+
+
+ + + + + +

+ 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: +

+
    +
  • *emphasis*
  • +
  • emphasis
  • +
+

+ 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: +

+
    +
  • *emphasized*
  • +
  • foo *emphasized* bar
  • +
  • *emphasized*foo*emphasized*
  • +
  • *emphasized*foo*
  • +
  • **emphasi*zed** foo*
  • +
  • * *emphasized*
  • +
+

+ Nothing would be formatted in the following messages (where / represents a + new line): +

+
    +
  • not emphasized*
  • +
  • *not emphasized
  • +
  • *not / emphasized*
  • +
  • **
  • +
  • ****
  • +
+
+ +

+ 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). +

+ + The full title is **Twelfth Night, or What You Will** but + *most* people shorten it. + +]]> +
+ +

+ Text enclosed by '_'(U+005F LOW LINE) MUST be displayed in italics. +

+ + The full title is _Twelfth Night, or What You Will_ but + __most__ people shorten it. + +]]> +
+ +

+ Text enclosed by '~'(U+007E TILDE) MUST be displayed with a horizontal + line through the middle (strike through). +

+ + Everyone ~dis~likes cake. + +]]> +
+ +

+ Text enclosed by a '`' (U+0060 GRAVE ACCENT) MUST be displayed inline in a + monospace font. + Inline formatting directives inside the inline preformatted text are not + rendered. + For example, in the following the word "monospace" is valid pre-formatted + inline text: +

+
    +
  • This is `monospace`
  • +
  • This is `*monospace*`
  • +
  • This is *`monospace and bold`*
  • +
+ + Wow, I can write in `monospace`, even a literal ``backtick (`)``! + +]]> +
+ +

+ A block of text surrounded by lines consisting of a sequence of three + backticks (U+0060 GRAVE ACCENT), "```", is preformatted text and should be + displayed exactly as it was entered including whitespace. + No other formatting described in this document should be rendered inside + a preformatted text block. +

+ + ``` + (println "Hello, world!") + ``` + + This should show up as monospaced, preformatted text ⤴ + +]]> +
+ +

+ A quotation is indicated by one or more lines with a byte stream beginning + with a '>' (U+003E GREATER-THAN SIGN) immediately followed by a + whitespace character. + Inline formatting is rendered inside of quotations. +

+ + > That that is, is. + + Said the old hermit of Prague. + +]]> + + >> That that is, is. + > Said the old hermit of Prague. + + Who? + +]]> +
+
+ +

+ The rules for inline styling form a context free grammar that cannot be + matched by a regular expression. + A simple stack based parser is recommended instead. +

+
+ +

+ When displaying text with formatting, developers should take care to ensure + sufficient contrast exists between styled and unstyled text so that users + with vision deficiencies are able to distinguish between the two. +

+
+ +

OPTIONAL.

+
+ +

REQUIRED.

+
+ +

+ This document requires no interaction with &IANA;. +

+
+ +

This specification defines the following XML namespaces:

+ +

+ The ®ISTRAR; shall include the foregoing namespaces in its disco + features registry as defined in &xep0030;. +

+ + urn:xmpp:styling:0 + Indicates support for simple message styling. + XEP-XXXX +]]> +
+ +

This document does not define any new XML structure requiring a schema.

+
+