index.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!doctype html>
  2. <title>CodeMirror: XML mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="xml.js"></script>
  8. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  9. <div id=nav>
  10. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">XML</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>XML mode</h2>
  23. <form><textarea id="code" name="code">
  24. &lt;html style="color: green"&gt;
  25. &lt;!-- this is a comment --&gt;
  26. &lt;head&gt;
  27. &lt;title&gt;HTML Example&lt;/title&gt;
  28. &lt;/head&gt;
  29. &lt;body&gt;
  30. The indentation tries to be &lt;em&gt;somewhat &amp;quot;do what
  31. I mean&amp;quot;&lt;/em&gt;... but might not match your style.
  32. &lt;/body&gt;
  33. &lt;/html&gt;
  34. </textarea></form>
  35. <script>
  36. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  37. mode: "text/html",
  38. lineNumbers: true
  39. });
  40. </script>
  41. <p>The XML mode supports these configuration parameters:</p>
  42. <dl>
  43. <dt><code>htmlMode (boolean)</code></dt>
  44. <dd>This switches the mode to parse HTML instead of XML. This
  45. means attributes do not have to be quoted, and some elements
  46. (such as <code>br</code>) do not require a closing tag.</dd>
  47. <dt><code>matchClosing (boolean)</code></dt>
  48. <dd>Controls whether the mode checks that close tags match the
  49. corresponding opening tag, and highlights mismatches as errors.
  50. Defaults to true.</dd>
  51. <dt><code>alignCDATA (boolean)</code></dt>
  52. <dd>Setting this to true will force the opening tag of CDATA
  53. blocks to not be indented.</dd>
  54. </dl>
  55. <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
  56. </article>