diff --git a/demo/btree.html b/demo/btree.html
index fc4997f4f59ff060b532181b9020bc9e85086bd0..ba07bc74f4dd437d1341d4827184e4095eab7865 100644
--- a/demo/btree.html
+++ b/demo/btree.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: B-Tree visualization</title>
 <meta charset="utf-8"/>
@@ -26,9 +26,7 @@
 <article>
 <h2>B-Tree visualization</h2>
 <form><textarea id="code" name="code">type here, see a summary of the document b-tree below</textarea></form>
-      </div>
       <div style="display: inline-block; height: 402px; overflow-y: auto" id="output"></div>
-    </div>
 
     <script id="me">
 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
diff --git a/demo/tern.html b/demo/tern.html
index b5194447df44c41d7a8d2c75c7077845d5d46a59..b7b65608e6d15e55d68ccdb1c5d90800d5ba5895 100644
--- a/demo/tern.html
+++ b/demo/tern.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: Tern Demo</title>
 <meta charset="utf-8"/>
@@ -76,7 +76,7 @@ baz.
 
 var randomStr = myMod.randomElt(myMod.strList);
 var randomInt = myMod.randomElt(myMod.intList);
-</textarea></p>
+</textarea></form>
 
 <p>Demonstrates integration of <a href="http://ternjs.net/">Tern</a>
 and CodeMirror. The following keys are bound:</p>
diff --git a/demo/xmlcomplete.html b/demo/xmlcomplete.html
index bd452e6f6e548fb6f60d563350abae4a524e2ed8..043f0c429c72944a3286cd967cbf4c431b8616c3 100644
--- a/demo/xmlcomplete.html
+++ b/demo/xmlcomplete.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: XML Autocomplete Demo</title>
 <meta charset="utf-8"/>
@@ -31,7 +31,7 @@
 <form><textarea id="code" name="code"><!-- write some xml below -->
 </textarea></form>
 
-    <p>Press <strong>ctrl-space</strong>, or type a '<' character to
+    <p>Press <strong>ctrl-space</strong>, or type a '&lt;' character to
     activate autocompletion. This demo defines a simple schema that
     guides completion. The schema can be customized—see
     the <a href="../doc/manual.html#addon_xml-hint">manual</a>.</p>
diff --git a/doc/internals.html b/doc/internals.html
index e1ed3e99137e0518e96a66dda0129c78ef26b6c0..079466f6302f2a1224b475414cef48d4c48ce5ad 100644
--- a/doc/internals.html
+++ b/doc/internals.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: Internals</title>
 <meta charset="utf-8"/>
@@ -500,4 +500,5 @@ composing is finished, but many don't fire anything when the character
 is updated <em>during</em> composition. So we poll, whenever the
 editor is focused, to provide immediate updates of the display.</p>
 
+</section>
 </article>
diff --git a/doc/manual.html b/doc/manual.html
index 5087df9061cf003b2de02807332a289307001cbf..25e66ed69a1aecfe25d5b0dcbfbce1f38a60bcd5 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: User Manual</title>
 <meta charset="utf-8"/>
@@ -3351,7 +3351,7 @@ editor.setOption("extraKeys", {
       be set to a certain position after the operation finishes, it
       can return a cursor object.</dd>
 
-      <dt id="vimapi_defineActon"><strong><code>defineAction(name: string, fn: function(cm: CodeMirror, ?actionArgs: object))</strong></code></dt>
+      <dt id="vimapi_defineActon"><strong><code>defineAction(name: string, fn: function(cm: CodeMirror, ?actionArgs: object))</code></strong></dt>
       <dd>Defines an action command, similar to
       <strong><code>defineMotion</code></strong>. Action commands
       can have arbitrary behavior, making them more flexible than
diff --git a/doc/releases.html b/doc/releases.html
index 74a7d49057952094fc7b389507db001b027fc7e8..6df8f04c65b4d00ea5a7c670047d54e744d3f095 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: Release History</title>
 <meta charset="utf-8"/>
@@ -408,7 +408,7 @@
   <p class="rel">16-01-2014: <a href="http://codemirror.net/codemirror-3.21.zip">Version 3.21</a>:</p>
 
   <ul class="rel-note">
-    <li>Auto-indenting a block will no longer add trailing whitespace to blank lines.</a>
+    <li>Auto-indenting a block will no longer add trailing whitespace to blank lines.</li>
     <li>Marking text has a new option <a href="manual.html#markText"><code>clearWhenEmpty</code></a> to control auto-removal.</li>
     <li>Several bugfixes in the handling of bidirectional text.</li>
     <li>The <a href="../mode/xml/index.html">XML</a> and <a href="../mode/css/index.html">CSS</a> modes were largely rewritten. <a href="../mode/css/less.html">LESS</a> support was added to the CSS mode.</li>
diff --git a/mode/asn.1/index.html b/mode/asn.1/index.html
index 8346f8e500d9cc99ab7cacec1de8f8cf20d6d21b..699fd4473d4b86f0402db44f647e79b63133d40f 100644
--- a/mode/asn.1/index.html
+++ b/mode/asn.1/index.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: ASN.1 mode</title>
 <meta charset="utf-8"/>
@@ -73,6 +73,5 @@
     <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
     </a>.</p>
     <p>Coded by Asmelash Tsegay Gebretsadkan </p>
-    </article>
 </article>
 
diff --git a/mode/handlebars/index.html b/mode/handlebars/index.html
index 8786fe3ab411cb037f7083a1e2b70ed407fa7fad..4f82d6028255c6fefd1a5eac90d6d7c4ab936d80 100644
--- a/mode/handlebars/index.html
+++ b/mode/handlebars/index.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: Handlebars mode</title>
 <meta charset="utf-8"/>
@@ -67,8 +67,7 @@
         mode: {name: "handlebars", base: "text/html"}
       });
     </script>
-    </script>
-
+    
     <p>Handlebars syntax highlighting for CodeMirror.</p>
 
     <p><strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>
diff --git a/mode/mumps/index.html b/mode/mumps/index.html
index bd1f69aef58bd4a867e3536cee7d1d3f3c49ce87..b1f92c213f48ad3556f249957b0178c610b4c822 100644
--- a/mode/mumps/index.html
+++ b/mode/mumps/index.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
 
 <title>CodeMirror: MUMPS mode</title>
 <meta charset="utf-8"/>
@@ -73,7 +73,7 @@ SET2() ;EF. Return error code (also called from XUSRB)
  IF '$LENGTH($PIECE(XUSER(1),U,2)) QUIT 21 ;p419, p434
  Q 0
  ;
-  </textarea>
+  </textarea></div>
     <script>
       var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
          mode: "mumps",
diff --git a/mode/nginx/index.html b/mode/nginx/index.html
index 5ffdc081cc73cb1cbd279913df3738fd68ffed0b..03cf671498878a43e3862e2701825fb118d92e92 100644
--- a/mode/nginx/index.html
+++ b/mode/nginx/index.html
@@ -1,5 +1,5 @@
-<!doctype html>
-
+<!doctype html>
+<head>
 <title>CodeMirror: NGINX mode</title>
 <meta charset="utf-8"/>
 <link rel=stylesheet href="../../doc/docs.css">
diff --git a/mode/pig/index.html b/mode/pig/index.html
index 984c9a1837faa7d4a233c6792a19436ef6c93354..ea77f70441b2a877969063b1b64dbcad1b0edb0f 100644
--- a/mode/pig/index.html
+++ b/mode/pig/index.html
@@ -1,5 +1,4 @@
-<!doctype html>
-
+<!doctype html>
 <title>CodeMirror: Pig Latin mode</title>
 <meta charset="utf-8"/>
 <link rel=stylesheet href="../../doc/docs.css">
@@ -51,5 +50,4 @@ STORE c INTO "\path\to\output";
 
     <p><strong>MIME type defined:</strong> <code>text/x-pig</code>
     (PIG code)
-</html>
 </article>
diff --git a/mode/tiki/tiki.css b/mode/tiki/tiki.css
index 0dbc3ea0e05228b56e76756b1516b9ae9079e27a..1d8704c78052b4f8f0aac00cc6f43e8e6ab6f6d6 100644
--- a/mode/tiki/tiki.css
+++ b/mode/tiki/tiki.css
@@ -15,7 +15,7 @@
 }
 
 .cm-tw-box {
-	border-top-width: 0px ! important;
+	border-top-width: 0px !important;
 	border-style: solid;
 	border-width: 1px;
 	border-color: inherit;