No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0394.xml 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Message Markup</title>
  10. <abstract>This specification provides an alternative to XHTML-IM with rigid separation of content and markup information, improving the resilience against spoofing and injection attacks.</abstract>
  11. &LEGALNOTICE;
  12. <number>0394</number>
  13. <status>Experimental</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies/>
  18. <supersedes/>
  19. <supersededby/>
  20. <shortname>markup</shortname>
  21. &jonaswielicki;
  22. <revision>
  23. <version>0.1.0</version>
  24. <date>2017-11-22</date>
  25. <initials>XEP Editor (ssw)</initials>
  26. <remark><p>First draft approved by the XMPP Council.</p></remark>
  27. </revision>
  28. <revision>
  29. <version>0.0.1</version>
  30. <date>2017-11-07</date>
  31. <initials>jwi</initials>
  32. <remark><p>First draft.</p></remark>
  33. </revision>
  34. </header>
  35. <section1 topic='Introduction' anchor='intro'>
  36. <p>Currently, &xep0071; or ad-hoc text-based formats are used to provide styling and semantic information in messages sent over the XMPP network.</p>
  37. <p>These approaches have several drawbacks, including but not limited to:</p>
  38. <ul>
  39. <li>Lack of standardisation (ad-hoc text-based formats), and thus interoperability.</li>
  40. <li>Lack of extensibility (ad-hoc text-based formats).</li>
  41. <li>Pollution of &lt;body/&gt; with markup information (ad-hoc text-based formats), possibly reducing accessiblity.</li>
  42. <li>Possibility of sending different textual content in the marked-up version vs. the plain-text version (XHTML-IM), allowing for spoofing attacks.</li>
  43. <li>Difficult to sanitize potentially malicious input (XHTML-IM mostly) (see e.g. <span class='ref'><link url='https://mail.jabber.org/pipermail/standards/2017-October/033546.html'>Security Issues with XHTML-IM (again)</link></span> <note>Security Issues with XHTML-IM (again) &lt;<link url='https://mail.jabber.org/pipermail/standards/2017-October/033546.html'>https://mail.jabber.org/pipermail/standards/2017-October/033546.html</link>&gt;.</note>), leading to injection attacks.</li>
  44. </ul>
  45. </section1>
  46. <section1 topic='Requirements' anchor='reqs'>
  47. <ul>
  48. <li>Textual data and markup metadata MUST be separated strictly.</li>
  49. <li>There MUST only be a single source of truth for the text associated with each content language in a message.</li>
  50. <li>The markup specification MUST be extensible in order to support more complex use-cases in the futurue.</li>
  51. <li>The markup SHOULD convey semantic information, if possible, as opposed to stylistic information.</li>
  52. <li>Entities SHOULD be able to cherry-pick a subset of the markup which is suitable for their presentation (for example, a terminal-based client may support inline emphasis and strike through, but no block-level markup).</li>
  53. <li>The specification MUST NOT require server support.</li>
  54. <li>Messages using this markup MUST NOT reduce readability for text-to-speech engines and other accessibility technologies.</li>
  55. <li>Messages using this markup MUST NOT reduce readability for people with color vision deficiencies.</li>
  56. <li>Requirements on the contents of the &lt;body/&gt; MUST NOT be imposed.</li>
  57. </ul>
  58. </section1>
  59. <section1 topic='Glossary' anchor='glossary'>
  60. <p>OPTIONAL.</p>
  61. </section1>
  62. <section1 topic='Use Cases' anchor='usecases'>
  63. <section2 topic='Transport inline markup' anchor='usecases-inline'>
  64. <p>Inline markup is declared with the &lt;span/&gt; element.</p>
  65. <example><![CDATA[
  66. <message>
  67. <body>There is really no reason to worry.</body>
  68. <markup xmlns="urn:xmpp:markup:0">
  69. <span start="9" end="15">
  70. <emphasis/>
  71. </span>
  72. </markup>
  73. </message>
  74. ]]></example>
  75. <p>The following child elements are defined for &lt;span/&gt;:</p>
  76. <ul>
  77. <li>&lt;emphasis/&gt;: The spanned range is emphasized. Suggested rendering: italics or bold.</li>
  78. <li>&lt;code/&gt;: The spanned range is some kind of machine code. Suggested rendering: monospaced.</li>
  79. <li>&lt;deleted/&gt;: The spanned range has been deleted. Suggested rendering: striked through.</li>
  80. </ul>
  81. <p>The start and end attributes define the range at which the span is applied. They are in units of unicode code points in the character data if the body element. The first affected codepoint is the one at start (where the first codepoint of a message has index 0) and the last affected codepoint is the one just before end. The above example could render in HTML as:</p>
  82. <div class="example">
  83. <p>There is <em>really</em> no reason to worry.</p>
  84. </div>
  85. </section2>
  86. <section2 topic='Transport code blocks' anchor='usecases-code'>
  87. <p>Code blocks are declared with the &lt;bcode/&gt; element:</p>
  88. <example><![CDATA[
  89. <message>
  90. <body>Just run this command:
  91. $ cowsay XMPP is awesome.</body>
  92. <markup xmlns="urn:xmpp:markup:0">
  93. <bcode start="23" end="48"/>
  94. </markup>
  95. </message>
  96. ]]></example>
  97. <p>The start and end attributes work just like for &lt;span/&gt;.</p>
  98. <p>The suggested rendering of code blocks is as block-level elements with monospaced font. The above example could render in HTML as:</p>
  99. <div class="example">
  100. <p>Just run this command:</p>
  101. <p style="font-family: monospace;">$ cowsay XMPP is awesome.</p>
  102. </div>
  103. </section2>
  104. <section2 topic='Transport itemized lists' anchor='usecases-itemized'>
  105. <p>Itemized lists are declared with the &lt;list/&gt; and &lt;li/&gt; elements:</p>
  106. <example><![CDATA[
  107. <message>
  108. <body>This XEP supports many things:
  109. * inline markup
  110. * code blocks
  111. * lists
  112. * and possibly more!</body>
  113. <markup xmlns="urn:xmpp:markup:0">
  114. <list start="31" end="89">
  115. <li start="31"/>
  116. <li start="47"/>
  117. <li start="61"/>
  118. <li start="69"/>
  119. </list>
  120. </markup>
  121. </message>
  122. ]]></example>
  123. <p>The start and end attributes of &lt;list/&gt; define the scope of the list. The start of the &lt;li/&gt; elements denote the start of a new list item. A list item continues until the end of the list or the start of the next list item. The first &lt;li/&gt; in a &lt;list/&gt; MUST have a start value equal to the start value of the &lt;list/&gt;.</p>
  124. <p>The above example could render in HTML as:</p>
  125. <div class="example">
  126. <p>This XEP supports many things:</p>
  127. <ul>
  128. <li>* inline markup</li>
  129. <li>* code blocks</li>
  130. <li>* lists</li>
  131. <li>* and possibly more!</li>
  132. </ul>
  133. </div>
  134. </section2>
  135. <section2 topic='Transport blockquotes' anchor='usecases-blockquote'>
  136. <p>A block quote is declared with a &lt;bquote/&gt; element:</p>
  137. <example><![CDATA[
  138. <message>
  139. <body>He said:
  140. &gt; Thou shalt not pass!
  141. and raised his hand.</body>
  142. <markup xmlns="urn:xmpp:markup:0">
  143. <bquote start="9" end="32"/>
  144. </markup>
  145. </message>
  146. ]]></example>
  147. <p>In addition, &xep0372; or a similar mechanism MAY be used to attribute the origin of the quote. The above example could render in HTML as:</p>
  148. <div class="example">
  149. <p>He said:</p>
  150. <blockquote>&gt; Thou shalt not pass!</blockquote>
  151. <p>and raised his hand.</p>
  152. </div>
  153. <p>A nested quotation can be created by adding two &lt;bquote/&gt; elements where the start/end range is nested. If plain text quotation markers are used, the start of the blockquote MUST be placed at the first quotation marker of the <em>outer</em> quote.</p>
  154. <example><![CDATA[
  155. <message>
  156. <body>&gt; He said:
  157. &gt;&gt; Thou shalt not pass!
  158. &gt; and raised his hand.
  159. Isn't this from some famous movie?</body>
  160. <markup xmlns="urn:xmpp:markup:0">
  161. <bquote start="0" end="57"/>
  162. <bquote start="11" end="34"/>
  163. </markup>
  164. </message>
  165. ]]></example>
  166. <p>The above example could render in HTML as:</p>
  167. <div class="example">
  168. <blockquote>&gt; He said:
  169. <blockquote>&gt;&gt; Thou shalt not pass!</blockquote>
  170. &gt; and raised his hand.
  171. </blockquote>
  172. <p>Isn't this from some famous movie?</p>
  173. </div>
  174. </section2>
  175. </section1>
  176. <section1 topic='Business Rules' anchor='rules'>
  177. <ul>
  178. <li>Spans MUST NOT overlap with each other.</li>
  179. <li>Spans MUST NOT overlap with the boundaries of a block-level markup element, but MAY be fully contained within a block-level markup element.</li>
  180. <li>Block level markup elements MUST NOT overlap with each others boundaries.</li>
  181. <li>There MUST NOT be a &lt;markup/&gt; element in a &lt;message/&gt; without corresponding &lt;body/&gt;. Note that there may be one &lt;markup/&gt; elements with appropriate xml:lang attribute value for each &lt;body/&gt;, if the message contains multiple &lt;body/&gt; elements.</li>
  182. <li>The start and end attributes operate on unicode code points in the XML character data of the corresponding &lt;body/&gt; element.</li>
  183. <li>Entities MUST silently ignore elements and attributes (arbitrarly deep) in &lt;markup/&gt; which they do not understand; this allows for future extensions of the markup without breaking existing implementations.</li>
  184. </ul>
  185. </section1>
  186. <section1 topic='Implementation Notes' anchor='impl'>
  187. <p>OPTIONAL.</p>
  188. </section1>
  189. <section1 topic='Accessibility Considerations' anchor='access'>
  190. <p>Entities are encouraged use the semantic information to make the presentation of the textual content more precise, for example by applying spoken emphasis to passages marked with an &lt;emphasis/&gt; &lt;span/&gt;.</p>
  191. </section1>
  192. <section1 topic='Internationalization Considerations' anchor='i18n'>
  193. <p>Since a message may have multiple &lt;body/&gt; elements in different languages, there MAY be multiple &lt;markup/&gt; elements, one for each of the &lt;body/&gt; elements. There is no requirement to include a &lt;markup/&gt; element for each language.</p>
  194. </section1>
  195. <section1 topic='Security Considerations' anchor='security'>
  196. <p>REQUIRED.</p>
  197. </section1>
  198. <section1 topic='IANA Considerations' anchor='iana'>
  199. <p>This document requires no interaction with &IANA;. </p>
  200. </section1>
  201. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  202. <p>This specification defines the following XML namespaces:</p>
  203. <ul>
  204. <li>urn:xmpp:markup:0</li>
  205. </ul>
  206. </section1>
  207. <section1 topic='XML Schema' anchor='schema'>
  208. <p>REQUIRED for protocol specifications.</p>
  209. </section1>
  210. <section1 topic='Acknowledgements' anchor='acknowledgements'>
  211. <p>Thanks to Georg Lukas and Emmanuel Gil Peyrot for feedback on the initial idea of this XEP.</p>
  212. </section1>
  213. </xep>