index.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: XML mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="xml.js"></script>
  9. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  10. <link rel="stylesheet" href="../../doc/docs.css">
  11. </head>
  12. <body>
  13. <h1>CodeMirror: XML mode</h1>
  14. <form><textarea id="code" name="code">
  15. &lt;html style="color: green"&gt;
  16. &lt;!-- this is a comment --&gt;
  17. &lt;head&gt;
  18. &lt;title&gt;HTML Example&lt;/title&gt;
  19. &lt;/head&gt;
  20. &lt;body&gt;
  21. The indentation tries to be &lt;em&gt;somewhat &amp;quot;do what
  22. I mean&amp;quot;&lt;/em&gt;... but might not match your style.
  23. &lt;/body&gt;
  24. &lt;/html&gt;
  25. </textarea></form>
  26. <script>
  27. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  28. mode: {name: "xml", alignCDATA: true},
  29. lineNumbers: true
  30. });
  31. </script>
  32. <p>The XML mode supports two configuration parameters:</p>
  33. <dl>
  34. <dt><code>htmlMode (boolean)</code></dt>
  35. <dd>This switches the mode to parse HTML instead of XML. This
  36. means attributes do not have to be quoted, and some elements
  37. (such as <code>br</code>) do not require a closing tag.</dd>
  38. <dt><code>alignCDATA (boolean)</code></dt>
  39. <dd>Setting this to true will force the opening tag of CDATA
  40. blocks to not be indented.</dd>
  41. </dl>
  42. <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
  43. </body>
  44. </html>