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