Improve white-space strictness of a number of elements
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56acf1a..fb3ea8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## 2.1.0
+
+* Improve strict spec compliance of `>` handling by always encoding as `>`
+  – unless preceded by `/`.
+* Improve strict spec compliance for `blockquote` by always putting the closing
+  tag on a new line.
+* Improve strict spec compliance for `code` elements defined with "\`".
+
 ## 2.0.3
 
 * Render element attributes in the order they were defined.
diff --git a/lib/src/html_renderer.dart b/lib/src/html_renderer.dart
index d77c6f2..4dfaa80 100644
--- a/lib/src/html_renderer.dart
+++ b/lib/src/html_renderer.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:collection';
+import 'dart:convert';
 
 import 'ast.dart';
 import 'block_parser.dart';
@@ -36,13 +37,30 @@
 /// Renders [nodes] to HTML.
 String renderToHtml(List<Node> nodes) => HtmlRenderer().render(nodes);
 
+const _blockTags = [
+  'blockquote',
+  'h1',
+  'h2',
+  'h3',
+  'h4',
+  'h5',
+  'h6',
+  'hr',
+  'li',
+  'ol',
+  'p',
+  'pre',
+  'ul',
+];
+
 /// Translates a parsed AST to HTML.
 class HtmlRenderer implements NodeVisitor {
-  static final _blockTags = RegExp('blockquote|h1|h2|h3|h4|h5|h6|hr|p|pre');
-
   StringBuffer buffer;
   Set<String> uniqueIds;
 
+  final _elementStack = <Element>[];
+  String _lastVisitedTag;
+
   HtmlRenderer();
 
   String render(List<Node> nodes) {
@@ -55,13 +73,23 @@
   }
 
   void visitText(Text text) {
-    buffer.write(text.text);
+    var content = text.text;
+    if (const ['p', 'li'].contains(_lastVisitedTag)) {
+      content =
+          LineSplitter.split(content).map((line) => line.trimLeft()).join('\n');
+      if (text.text.endsWith('\n')) {
+        content = '$content\n';
+      }
+    }
+    buffer.write(content);
+
+    _lastVisitedTag = null;
   }
 
   bool visitElementBefore(Element element) {
     // Hackish. Separate block-level elements with newlines.
-    if (buffer.isNotEmpty && _blockTags.firstMatch(element.tag) != null) {
-      buffer.write('\n');
+    if (buffer.isNotEmpty && _blockTags.contains(element.tag)) {
+      buffer.writeln();
     }
 
     buffer.write('<${element.tag}');
@@ -75,6 +103,8 @@
       buffer.write(' id="${uniquifyId(element.generatedId)}"');
     }
 
+    _lastVisitedTag = element.tag;
+
     if (element.isEmpty) {
       // Empty element like <hr/>.
       buffer.write(' />');
@@ -85,13 +115,26 @@
 
       return false;
     } else {
+      _elementStack.add(element);
       buffer.write('>');
       return true;
     }
   }
 
   void visitElementAfter(Element element) {
+    assert(identical(_elementStack.last, element));
+
+    if (element.children != null &&
+        element.children.isNotEmpty &&
+        _blockTags.contains(_lastVisitedTag) &&
+        _blockTags.contains(element.tag)) {
+      buffer.writeln();
+    } else if (element.tag == 'blockquote') {
+      buffer.writeln();
+    }
     buffer.write('</${element.tag}>');
+
+    _lastVisitedTag = _elementStack.removeLast().tag;
   }
 
   /// Uniquifies an id generated from text.
diff --git a/lib/src/inline_parser.dart b/lib/src/inline_parser.dart
index b7e0c0c..5e7e918 100644
--- a/lib/src/inline_parser.dart
+++ b/lib/src/inline_parser.dart
@@ -40,8 +40,10 @@
     TextSyntax(r'&[#a-zA-Z0-9]*;'),
     // Encode "&".
     TextSyntax(r'&', sub: '&amp;'),
-    // Encode "<". (Why not encode ">" too? Gruber is toying with us.)
+    // Encode "<".
     TextSyntax(r'<', sub: '&lt;'),
+    // Encode ">".
+    TextSyntax(r'>', sub: '&gt;'),
     // We will add the LinkSyntax once we know about the specific link resolver.
   ]);
 
@@ -206,8 +208,15 @@
       : substitute = sub,
         super(pattern);
 
+  /// Adds a [Text] node to [parser] and returns `true` if there is a
+  /// [substitute], as long as the preceding character (if any) is not a `/`.
+  ///
+  /// Otherwise, the parser is advanced by the length of [match] and `false` is
+  /// returned.
   bool onMatch(InlineParser parser, Match match) {
-    if (substitute == null) {
+    if (substitute == null ||
+        (match.start > 0 &&
+            match.input.substring(match.start - 1, match.start) == '/')) {
       // Just use the original matched text.
       parser.advanceBy(match[0].length);
       return false;
@@ -1068,7 +1077,7 @@
   }
 
   bool onMatch(InlineParser parser, Match match) {
-    var code = match[2].trim();
+    var code = match[2].trim().replaceAll('\n', ' ');
     if (parser.document.encodeHtml) code = escapeHtml(code);
     parser.addNode(Element.text('code', code));
 
diff --git a/lib/src/version.dart b/lib/src/version.dart
index 170650c..9271c18 100644
--- a/lib/src/version.dart
+++ b/lib/src/version.dart
@@ -1,2 +1,2 @@
 // Generated code. Do not modify.
-const packageVersion = '2.0.3';
+const packageVersion = '2.1.0-dev';
diff --git a/pubspec.yaml b/pubspec.yaml
index b0181a5..7ec2c5e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: markdown
-version: 2.0.3
+version: 2.1.0-dev
 
 description: A library for converting markdown to HTML.
 author: Dart Team <misc@dartlang.org>
diff --git a/test/common_mark/atx_headings.unit b/test/common_mark/atx_headings.unit
index 7813d9d..04e8d9f 100644
--- a/test/common_mark/atx_headings.unit
+++ b/test/common_mark/atx_headings.unit
@@ -53,7 +53,7 @@
     # bar
 <<<
 <p>foo
-    # bar</p>
+# bar</p>
 >>> ATX headings - 41
 ## foo ##
   ###   bar    ###
diff --git a/test/common_mark/autolinks.unit b/test/common_mark/autolinks.unit
index de023be..00279ee 100644
--- a/test/common_mark/autolinks.unit
+++ b/test/common_mark/autolinks.unit
@@ -33,7 +33,7 @@
 >>> Autolinks - 598
 <http://foo.bar/baz bim>
 <<<
-<p>&lt;http://foo.bar/baz bim></p>
+<p>&lt;http://foo.bar/baz bim&gt;</p>
 >>> Autolinks - 599
 <http://example.com/\[\>
 <<<
@@ -49,23 +49,23 @@
 >>> Autolinks - 602
 <foo\+@bar.example.com>
 <<<
-<p>&lt;foo+@bar.example.com></p>
+<p>&lt;foo+@bar.example.com&gt;</p>
 >>> Autolinks - 603
 <>
 <<<
-<p>&lt;></p>
+<p>&lt;&gt;</p>
 >>> Autolinks - 604
 < http://foo.bar >
 <<<
-<p>&lt; http://foo.bar ></p>
+<p>&lt; http://foo.bar &gt;</p>
 >>> Autolinks - 605
 <m:abc>
 <<<
-<p>&lt;m:abc></p>
+<p>&lt;m:abc&gt;</p>
 >>> Autolinks - 606
 <foo.bar.baz>
 <<<
-<p>&lt;foo.bar.baz></p>
+<p>&lt;foo.bar.baz&gt;</p>
 >>> Autolinks - 607
 http://example.com
 <<<
diff --git a/test/common_mark/block_quotes.unit b/test/common_mark/block_quotes.unit
index 7d00483..a527187 100644
--- a/test/common_mark/block_quotes.unit
+++ b/test/common_mark/block_quotes.unit
@@ -6,7 +6,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 199
 ># Foo
 >bar
@@ -15,7 +16,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 200
    > # Foo
    > bar
@@ -24,7 +26,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 201
     > # Foo
     > bar
@@ -42,7 +45,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 203
 > bar
 baz
@@ -51,26 +55,36 @@
 <blockquote>
 <p>bar
 baz
-foo</p></blockquote>
+foo</p>
+</blockquote>
 >>> Block quotes - 204
 > foo
 ---
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <hr />
 >>> Block quotes - 205
 > - foo
 - bar
 <<<
-<blockquote><ul><li>foo</li></ul></blockquote><ul><li>bar</li></ul>
+<blockquote>
+<ul>
+<li>foo</li>
+</ul>
+</blockquote>
+<ul>
+<li>bar</li>
+</ul>
 >>> Block quotes - 206
 >     foo
     bar
 <<<
 <blockquote>
 <pre><code>foo
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <pre><code>bar
 </code></pre>
 >>> Block quotes - 207
@@ -80,7 +94,8 @@
 <<<
 <blockquote>
 <pre><code>foo
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <pre><code>
 </code></pre>
 >>> Block quotes - 208
@@ -88,42 +103,49 @@
     - bar
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <pre><code>- bar
 </code></pre>
 >>> Block quotes - 209
 >
 <<<
-<blockquote></blockquote>
+<blockquote>
+</blockquote>
 >>> Block quotes - 210
 >
 >  
 > 
 <<<
-<blockquote></blockquote>
+<blockquote>
+</blockquote>
 >>> Block quotes - 211
 >
 > foo
 >  
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 >>> Block quotes - 212
 > foo
 
 > bar
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Block quotes - 213
 > foo
 > bar
 <<<
 <blockquote>
 <p>foo
-bar</p></blockquote>
+bar</p>
+</blockquote>
 >>> Block quotes - 214
 > foo
 >
@@ -131,38 +153,44 @@
 <<<
 <blockquote>
 <p>foo</p>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Block quotes - 215
 foo
 > bar
 <<<
 <p>foo</p>
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Block quotes - 216
 > aaa
 ***
 > bbb
 <<<
 <blockquote>
-<p>aaa</p></blockquote>
+<p>aaa</p>
+</blockquote>
 <hr />
 <blockquote>
-<p>bbb</p></blockquote>
+<p>bbb</p>
+</blockquote>
 >>> Block quotes - 217
 > bar
 baz
 <<<
 <blockquote>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 218
 > bar
 
 baz
 <<<
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 <p>baz</p>
 >>> Block quotes - 219
 > bar
@@ -171,7 +199,8 @@
 <<<
 <blockquote>
 <p>bar</p>
-<p>baz</p></blockquote>
+<p>baz</p>
+</blockquote>
 >>> Block quotes - 220
 > > > foo
 bar
@@ -180,7 +209,10 @@
 <blockquote>
 <blockquote>
 <p>foo
-bar</p></blockquote></blockquote></blockquote>
+bar</p>
+</blockquote>
+</blockquote>
+</blockquote>
 >>> Block quotes - 221
 >>> foo
 > bar
@@ -191,7 +223,10 @@
 <blockquote>
 <p>foo
 bar
-baz</p></blockquote></blockquote></blockquote>
+baz</p>
+</blockquote>
+</blockquote>
+</blockquote>
 >>> Block quotes - 222
 >     code
 
@@ -199,6 +234,8 @@
 <<<
 <blockquote>
 <pre><code>code
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <blockquote>
-<p>   not code</p></blockquote>
+<p>not code</p>
+</blockquote>
diff --git a/test/common_mark/code_spans.unit b/test/common_mark/code_spans.unit
index 221b75c..069bd88 100644
--- a/test/common_mark/code_spans.unit
+++ b/test/common_mark/code_spans.unit
@@ -35,9 +35,7 @@
 baz
 ``
 <<<
-<p><code>foo
-bar  
-baz</code></p>
+<p><code>foo bar   baz</code></p>
 >>> Code spans - 336
 ``
 foo 
@@ -48,8 +46,7 @@
 `foo   bar 
 baz`
 <<<
-<p><code>foo   bar 
-baz</code></p>
+<p><code>foo   bar  baz</code></p>
 >>> Code spans - 338
 `foo\`bar`
 <<<
@@ -73,7 +70,7 @@
 >>> Code spans - 343
 `<a href="`">`
 <<<
-<p><code>&lt;a href="</code>">`</p>
+<p><code>&lt;a href="</code>"&gt;`</p>
 >>> Code spans - 344
 <a href="`">`
 <<<
@@ -81,7 +78,7 @@
 >>> Code spans - 345
 `<http://foo.bar.`baz>`
 <<<
-<p><code>&lt;http://foo.bar.</code>baz>`</p>
+<p><code>&lt;http://foo.bar.</code>baz&gt;`</p>
 >>> Code spans - 346
 <http://foo.bar.`baz>`
 <<<
diff --git a/test/common_mark/emphasis_and_strong_emphasis.unit b/test/common_mark/emphasis_and_strong_emphasis.unit
index c08e288..f93b96d 100644
--- a/test/common_mark/emphasis_and_strong_emphasis.unit
+++ b/test/common_mark/emphasis_and_strong_emphasis.unit
@@ -66,7 +66,10 @@
 *foo bar
 *
 <<<
-<p>*foo bar</p><ul><li></li></ul>
+<p>*foo bar</p>
+<ul>
+<li></li>
+</ul>
 >>> Emphasis and strong emphasis - 367
 *(*foo)
 <<<
diff --git a/test/common_mark/entity_and_numeric_character_references.unit b/test/common_mark/entity_and_numeric_character_references.unit
index c707056..32a77cb 100644
--- a/test/common_mark/entity_and_numeric_character_references.unit
+++ b/test/common_mark/entity_and_numeric_character_references.unit
@@ -73,7 +73,10 @@
 
 * foo
 <<<
-<p>&#42; foo</p><ul><li>foo</li></ul>
+<p>&#42; foo</p>
+<ul>
+<li>foo</li>
+</ul>
 >>> Entity and numeric character references - 325
 foo&#10;&#10;bar
 <<<
diff --git a/test/common_mark/fenced_code_blocks.unit b/test/common_mark/fenced_code_blocks.unit
index b6ca0ab..2e30524 100644
--- a/test/common_mark/fenced_code_blocks.unit
+++ b/test/common_mark/fenced_code_blocks.unit
@@ -82,7 +82,8 @@
 <<<
 <blockquote>
 <pre><code>aaa
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <p>bbb</p>
 >>> Fenced code blocks - 99
 ```
diff --git a/test/common_mark/hard_line_breaks.unit b/test/common_mark/hard_line_breaks.unit
index b811e50..4c8f0ed 100644
--- a/test/common_mark/hard_line_breaks.unit
+++ b/test/common_mark/hard_line_breaks.unit
@@ -44,14 +44,12 @@
 `code 
 span`
 <<<
-<p><code>code 
-span</code></p>
+<p><code>code  span</code></p>
 >>> Hard line breaks - 638
 `code\
 span`
 <<<
-<p><code>code\
-span</code></p>
+<p><code>code\ span</code></p>
 >>> Hard line breaks - 639
 <a href="foo  
 bar">
diff --git a/test/common_mark/html_blocks.unit b/test/common_mark/html_blocks.unit
index 0f73985..ab15985 100644
--- a/test/common_mark/html_blocks.unit
+++ b/test/common_mark/html_blocks.unit
@@ -234,13 +234,17 @@
 bar
 <<<
 <blockquote><div>
-foo</blockquote>
+foo
+</blockquote>
 <p>bar</p>
 >>> HTML blocks - 144
 - <div>
 - foo
 <<<
-<ul><li><div></li><li>foo</li></ul>
+<ul>
+<li><div></li>
+<li>foo</li>
+</ul>
 >>> HTML blocks - 145
 <style>p{color:red;}</style>
 *foo*
diff --git a/test/common_mark/indented_code_blocks.unit b/test/common_mark/indented_code_blocks.unit
index dd7cf87..0dffa1d 100644
--- a/test/common_mark/indented_code_blocks.unit
+++ b/test/common_mark/indented_code_blocks.unit
@@ -10,16 +10,25 @@
 
     bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
-<p>bar</p></li></ul>
+<p>bar</p>
+</li>
+</ul>
 >>> Indented code blocks - 79
 1.  foo
 
     - bar
 <<<
-<ol><li>
-<p> foo</p><ul><li>bar</li></ul></li></ol>
+<ol>
+<li>
+<p>foo</p>
+<ul>
+<li>bar</li>
+</ul>
+</li>
+</ol>
 >>> Indented code blocks - 80
     <a/>
     *hi*
@@ -61,7 +70,7 @@
 
 <<<
 <p>Foo
-    bar</p>
+bar</p>
 >>> Indented code blocks - 84
     foo
 bar
diff --git a/test/common_mark/link_reference_definitions.unit b/test/common_mark/link_reference_definitions.unit
index 88fa981..388ed8d 100644
--- a/test/common_mark/link_reference_definitions.unit
+++ b/test/common_mark/link_reference_definitions.unit
@@ -165,7 +165,8 @@
 <<<
 <h1><a href="/url">Foo</a></h1>
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Link reference definitions - 184
 [foo]: /url
 bar
@@ -201,7 +202,8 @@
 > [foo]: /url
 <<<
 <p><a href="/url">foo</a></p>
-<blockquote></blockquote>
+<blockquote>
+</blockquote>
 >>> Link reference definitions - 188
 [foo]: /url
 <<<
diff --git a/test/common_mark/links.unit b/test/common_mark/links.unit
index ea917b0..7f9707f 100644
--- a/test/common_mark/links.unit
+++ b/test/common_mark/links.unit
@@ -48,7 +48,7 @@
 [a](<b>c)
 <<<
 <p>[a](&lt;b)c
-[a](&lt;b)c>
+[a](&lt;b)c&gt;
 [a](<b>c)</p>
 >>> Links - 492
 [link](\(foo\))
diff --git a/test/common_mark/list_items.unit b/test/common_mark/list_items.unit
index 6fc3c90..87a7cec 100644
--- a/test/common_mark/list_items.unit
+++ b/test/common_mark/list_items.unit
@@ -11,7 +11,8 @@
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote>
+<p>A block quote.</p>
+</blockquote>
 >>> List items - 224
 1.  A paragraph
     with two lines.
@@ -20,34 +21,45 @@
 
     > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 225
 - one
 
  two
 <<<
-<ul><li>one</li></ul>
-<p> two</p>
+<ul>
+<li>one</li>
+</ul>
+<p>two</p>
 >>> List items - 226
 - one
 
   two
 <<<
-<ul><li>
+<ul>
+<li>
 <p>one</p>
-<p>two</p></li></ul>
+<p>two</p>
+</li>
+</ul>
 >>> List items - 227
  -    one
 
      two
 <<<
-<ul><li>   one</li></ul>
+<ul>
+<li>one</li>
+</ul>
 <pre><code> two
 </code></pre>
 >>> List items - 228
@@ -55,26 +67,40 @@
 
       two
 <<<
-<ul><li>
-<p>   one</p>
-<p>two</p></li></ul>
+<ul>
+<li>
+<p>one</p>
+<p>two</p>
+</li>
+</ul>
 >>> List items - 229
    > > 1.  one
 >>
 >>     two
 <<<
 <blockquote>
-<blockquote><ol><li>
-<p> one</p>
-<p>two</p></li></ol></blockquote></blockquote>
+<blockquote>
+<ol>
+<li>
+<p>one</p>
+<p>two</p>
+</li>
+</ol>
+</blockquote>
+</blockquote>
 >>> List items - 230
 >>- one
 >>
   >  > two
 <<<
 <blockquote>
-<blockquote><ul><li>one</li></ul>
-<p>two</p></blockquote></blockquote>
+<blockquote>
+<ul>
+<li>one</li>
+</ul>
+<p>two</p>
+</blockquote>
+</blockquote>
 >>> List items - 231
 -one
 
@@ -88,8 +114,10 @@
 
   bar
 <<<
-<ul><li>foo</li></ul>
-<p>  bar</p>
+<ul>
+<li>foo</li>
+</ul>
+<p>bar</p>
 >>> List items - 233
 1.  foo
 
@@ -101,13 +129,17 @@
 
     > bam
 <<<
-<ol><li>
-<p> foo</p>
+<ol>
+<li>
+<p>foo</p>
 <pre><code>bar
 </code></pre>
 <p>baz</p>
 <blockquote>
-<p>bam</p></blockquote></li></ol>
+<p>bam</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 234
 - Foo
 
@@ -116,16 +148,21 @@
 
       baz
 <<<
-<ul><li>
+<ul>
+<li>
 <p>Foo</p>
 <pre><code>bar
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 <pre><code>  baz
 </code></pre>
 >>> List items - 235
 123456789. ok
 <<<
-<ol start="123456789"><li>ok</li></ol>
+<ol start="123456789">
+<li>ok</li>
+</ol>
 >>> List items - 236
 1234567890. not ok
 <<<
@@ -133,11 +170,15 @@
 >>> List items - 237
 0. ok
 <<<
-<ol start="0"><li>ok</li></ol>
+<ol start="0">
+<li>ok</li>
+</ol>
 >>> List items - 238
 003. ok
 <<<
-<ol start="3"><li>ok</li></ol>
+<ol start="3">
+<li>ok</li>
+</ol>
 >>> List items - 239
 -1. not ok
 <<<
@@ -147,19 +188,25 @@
 
       bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
 <pre><code>bar
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> List items - 241
   10.  foo
 
            bar
 <<<
-<ol start="10"><li>
-<p> foo</p>
+<ol start="10">
+<li>
+<p>foo</p>
 <pre><code>bar
-</code></pre></li></ol>
+</code></pre>
+</li>
+</ol>
 >>> List items - 242
     indented code
 
@@ -179,12 +226,15 @@
 
        more code
 <<<
-<ol><li>
+<ol>
+<li>
 <pre><code>indented code
 </code></pre>
 <p>paragraph</p>
 <pre><code>more code
-</code></pre></li></ol>
+</code></pre>
+</li>
+</ol>
 >>> List items - 244
 1.      indented code
 
@@ -192,34 +242,42 @@
 
        more code
 <<<
-<ol><li>
+<ol>
+<li>
 <pre><code> indented code
 </code></pre>
 <p>paragraph</p>
 <pre><code>more code
-</code></pre></li></ol>
+</code></pre>
+</li>
+</ol>
 >>> List items - 245
    foo
 
 bar
 <<<
-<p>   foo</p>
+<p>foo</p>
 <p>bar</p>
 >>> List items - 246
 -    foo
 
   bar
 <<<
-<ul><li>   foo</li></ul>
-<p>  bar</p>
+<ul>
+<li>foo</li>
+</ul>
+<p>bar</p>
 >>> List items - 247
 -  foo
 
    bar
 <<<
-<ul><li>
-<p> foo</p>
-<p>bar</p></li></ul>
+<ul>
+<li>
+<p>foo</p>
+<p>bar</p>
+</li>
+</ul>
 >>> List items - 248
 -
   foo
@@ -230,45 +288,70 @@
 -
       baz
 <<<
-<ul><li>foo</li><li>
+<ul>
+<li>foo</li>
+<li>
 <pre><code>bar
-</code></pre></li><li>
+</code></pre>
+</li>
+<li>
 <pre><code>baz
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> List items - 249
 -   
   foo
 <<<
-<ul><li>foo</li></ul>
+<ul>
+<li>foo</li>
+</ul>
 >>> List items - 250
 -
 
   foo
 <<<
-<ul><li>
-<p>foo</p></li></ul>
+<ul>
+<li>
+<p>foo</p>
+</li>
+</ul>
 >>> List items - 251
 - foo
 -
 - bar
 <<<
-<ul><li>foo</li><li></li><li>bar</li></ul>
+<ul>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ul>
 >>> List items - 252
 - foo
 -   
 - bar
 <<<
-<ul><li>foo</li><li></li><li>bar</li></ul>
+<ul>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ul>
 >>> List items - 253
 1. foo
 2.
 3. bar
 <<<
-<ol><li>foo</li><li></li><li>bar</li></ol>
+<ol>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ol>
 >>> List items - 254
 *
 <<<
-<ul><li></li></ul>
+<ul>
+<li></li>
+</ul>
 >>> List items - 255
 foo
 *
@@ -276,8 +359,14 @@
 foo
 1.
 <<<
-<p>foo</p><ul><li></li></ul>
-<p>foo</p><ol><li></li></ol>
+<p>foo</p>
+<ul>
+<li></li>
+</ul>
+<p>foo</p>
+<ol>
+<li></li>
+</ol>
 >>> List items - 256
  1.  A paragraph
      with two lines.
@@ -286,13 +375,17 @@
 
      > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 257
   1.  A paragraph
       with two lines.
@@ -301,13 +394,17 @@
 
       > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 258
    1.  A paragraph
        with two lines.
@@ -316,13 +413,17 @@
 
        > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 259
     1.  A paragraph
         with two lines.
@@ -346,73 +447,141 @@
 
       > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 261
   1.  A paragraph
     with two lines.
 <<<
-<ol><li> A paragraph
-    with two lines.</li></ol>
+<ol>
+<li>A paragraph
+with two lines.</li>
+</ol>
 >>> List items - 262
 > 1. > Blockquote
 continued here.
 <<<
-<blockquote><ol><li>
+<blockquote>
+<ol>
+<li>
 <blockquote>
 <p>Blockquote
-continued here.</p></blockquote></li></ol></blockquote>
+continued here.</p>
+</blockquote>
+</li>
+</ol>
+</blockquote>
 >>> List items - 263
 > 1. > Blockquote
 > continued here.
 <<<
-<blockquote><ol><li>
+<blockquote>
+<ol>
+<li>
 <blockquote>
 <p>Blockquote
-continued here.</p></blockquote></li></ol></blockquote>
+continued here.</p>
+</blockquote>
+</li>
+</ol>
+</blockquote>
 >>> List items - 264
 - foo
   - bar
     - baz
       - boo
 <<<
-<ul><li>foo<ul><li>bar<ul><li>baz<ul><li>boo</li></ul></li></ul></li></ul></li></ul>
+<ul>
+<li>foo
+<ul>
+<li>bar
+<ul>
+<li>baz
+<ul>
+<li>boo</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
 >>> List items - 265
 - foo
  - bar
   - baz
    - boo
 <<<
-<ul><li>foo</li><li>bar</li><li>baz</li><li>boo</li></ul>
+<ul>
+<li>foo</li>
+<li>bar</li>
+<li>baz</li>
+<li>boo</li>
+</ul>
 >>> List items - 266
 10) foo
     - bar
 <<<
-<ol start="10"><li>foo<ul><li>bar</li></ul></li></ol>
+<ol start="10">
+<li>foo
+<ul>
+<li>bar</li>
+</ul>
+</li>
+</ol>
 >>> List items - 267
 10) foo
    - bar
 <<<
-<ol start="10"><li>foo</li></ol><ul><li>bar</li></ul>
+<ol start="10">
+<li>foo</li>
+</ol>
+<ul>
+<li>bar</li>
+</ul>
 >>> List items - 268
 - - foo
 <<<
-<ul><li><ul><li>foo</li></ul></li></ul>
+<ul>
+<li>
+<ul>
+<li>foo</li>
+</ul>
+</li>
+</ul>
 >>> List items - 269
 1. - 2. foo
 <<<
-<ol><li><ul><li><ol start="2"><li>foo</li></ol></li></ul></li></ol>
+<ol>
+<li>
+<ul>
+<li>
+<ol start="2">
+<li>foo</li>
+</ol>
+</li>
+</ul>
+</li>
+</ol>
 >>> List items - 270
 - # Foo
 - Bar
   ---
   baz
 <<<
-<ul><li>
-<h1>Foo</h1></li><li>
-<h2>Bar</h2>baz</li></ul>
+<ul>
+<li>
+<h1>Foo</h1>
+</li>
+<li>
+<h2>Bar</h2>baz</li>
+</ul>
diff --git a/test/common_mark/lists.unit b/test/common_mark/lists.unit
index 239c1ea..88640f5 100644
--- a/test/common_mark/lists.unit
+++ b/test/common_mark/lists.unit
@@ -3,29 +3,51 @@
 - bar
 + baz
 <<<
-<ul><li>foo</li><li>bar</li></ul><ul><li>baz</li></ul>
+<ul>
+<li>foo</li>
+<li>bar</li>
+</ul>
+<ul>
+<li>baz</li>
+</ul>
 >>> Lists - 272
 1. foo
 2. bar
 3) baz
 <<<
-<ol><li>foo</li><li>bar</li></ol><ol start="3"><li>baz</li></ol>
+<ol>
+<li>foo</li>
+<li>bar</li>
+</ol>
+<ol start="3">
+<li>baz</li>
+</ol>
 >>> Lists - 273
 Foo
 - bar
 - baz
 <<<
-<p>Foo</p><ul><li>bar</li><li>baz</li></ul>
+<p>Foo</p>
+<ul>
+<li>bar</li>
+<li>baz</li>
+</ul>
 >>> Lists - 274
 The number of windows in my house is
 14.  The number of doors is 6.
 <<<
-<p>The number of windows in my house is</p><ol start="14"><li> The number of doors is 6.</li></ol>
+<p>The number of windows in my house is</p>
+<ol start="14">
+<li>The number of doors is 6.</li>
+</ol>
 >>> Lists - 275
 The number of windows in my house is
 1.  The number of doors is 6.
 <<<
-<p>The number of windows in my house is</p><ol><li> The number of doors is 6.</li></ol>
+<p>The number of windows in my house is</p>
+<ol>
+<li>The number of doors is 6.</li>
+</ol>
 >>> Lists - 276
 - foo
 
@@ -34,9 +56,17 @@
 
 - baz
 <<<
-<ul><li>
-<p>foo</p></li><li>
-<p>bar</p></li></ul><ul><li>baz</li></ul>
+<ul>
+<li>
+<p>foo</p>
+</li>
+<li>
+<p>bar</p>
+</li>
+</ul>
+<ul>
+<li>baz</li>
+</ul>
 >>> Lists - 277
 - foo
   - bar
@@ -45,7 +75,17 @@
 
       bim
 <<<
-<ul><li>foo<ul><li>bar<ul><li>baz</li></ul></li></ul></li></ul>
+<ul>
+<li>foo
+<ul>
+<li>bar
+<ul>
+<li>baz</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
 <pre><code>  bim
 </code></pre>
 >>> Lists - 278
@@ -57,7 +97,14 @@
 - baz
 - bim
 <<<
-<ul><li>foo</li><li>bar</li></ul><!-- --><ul><li>baz</li><li>bim</li></ul>
+<ul>
+<li>foo</li>
+<li>bar</li>
+</ul><!-- -->
+<ul>
+<li>baz</li>
+<li>bim</li>
+</ul>
 >>> Lists - 279
 -   foo
 
@@ -69,10 +116,15 @@
 
     code
 <<<
-<ul><li>
-<p>  foo</p>
-<p>notcode</p></li><li>
-<p>  foo</p></li></ul><!-- -->
+<ul>
+<li>
+<p>foo</p>
+<p>notcode</p>
+</li>
+<li>
+<p>foo</p>
+</li>
+</ul><!-- -->
 <pre><code>code
 </code></pre>
 >>> Lists - 280
@@ -84,7 +136,15 @@
  - f
 - g
 <<<
-<ul><li>a</li><li>b</li><li>c</li><li>d</li><li>e</li><li>f</li><li>g</li></ul>
+<ul>
+<li>a</li>
+<li>b</li>
+<li>c</li>
+<li>d</li>
+<li>e</li>
+<li>f</li>
+<li>g</li>
+</ul>
 >>> Lists - 281
 1. a
 
@@ -92,10 +152,17 @@
 
    3. c
 <<<
-<ol><li>
-<p>a</p></li><li>
-<p>b</p></li><li>
-<p>c</p></li></ol>
+<ol>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p>
+</li>
+<li>
+<p>c</p>
+</li>
+</ol>
 >>> Lists - 282
 - a
  - b
@@ -103,8 +170,13 @@
    - d
     - e
 <<<
-<ul><li>a</li><li>b</li><li>c</li><li>d
-    - e</li></ul>
+<ul>
+<li>a</li>
+<li>b</li>
+<li>c</li>
+<li>d
+- e</li>
+</ul>
 >>> Lists - 283
 1. a
 
@@ -112,9 +184,14 @@
 
     3. c
 <<<
-<ol><li>
-<p>a</p></li><li>
-<p>b</p></li></ol>
+<ol>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p>
+</li>
+</ol>
 <pre><code>3. c
 </code></pre>
 >>> Lists - 284
@@ -123,19 +200,32 @@
 
 - c
 <<<
-<ul><li>
-<p>a</p></li><li>
-<p>b</p></li><li>
-<p>c</p></li></ul>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p>
+</li>
+<li>
+<p>c</p>
+</li>
+</ul>
 >>> Lists - 285
 * a
 *
 
 * c
 <<<
-<ul><li>
-<p>a</p></li><li></li><li>
-<p>c</p></li></ul>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li></li>
+<li>
+<p>c</p>
+</li>
+</ul>
 >>> Lists - 286
 - a
 - b
@@ -143,11 +233,18 @@
   c
 - d
 <<<
-<ul><li>
-<p>a</p></li><li>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li>
 <p>b</p>
-<p>c</p></li><li>
-<p>d</p></li></ul>
+<p>c</p>
+</li>
+<li>
+<p>d</p>
+</li>
+</ul>
 >>> Lists - 287
 - a
 - b
@@ -155,10 +252,16 @@
   [ref]: /url
 - d
 <<<
-<ul><li>
-<p>a</p></li><li>
-<p>b</p></li><li>
-<p>d</p></li></ul>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p></li>
+<li>
+<p>d</p>
+</li>
+</ul>
 >>> Lists - 288
 - a
 - ```
@@ -168,9 +271,13 @@
   ```
 - c
 <<<
-<ul><li>a</li><li>
+<ul>
+<li>a</li>
+<li>
 <pre><code>b
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 <pre><code>- c
 
 </code></pre>
@@ -181,18 +288,31 @@
     c
 - d
 <<<
-<ul><li>a<ul><li>
+<ul>
+<li>a
+<ul>
+<li>
 <p>b</p>
-<p>c</p></li></ul></li><li>d</li></ul>
+<p>c</p>
+</li>
+</ul>
+</li>
+<li>d</li>
+</ul>
 >>> Lists - 290
 * a
   > b
   >
 * c
 <<<
-<ul><li>a
+<ul>
+<li>a
 <blockquote>
-<p>b</p></blockquote></li><li>c</li></ul>
+<p>b</p>
+</blockquote>
+</li>
+<li>c</li>
+</ul>
 >>> Lists - 291
 - a
   > b
@@ -201,20 +321,33 @@
   ```
 - d
 <<<
-<ul><li>a
+<ul>
+<li>a
 <blockquote>
-<p>b</p></blockquote>
+<p>b</p>
+</blockquote>
 <pre><code>c
-</code></pre></li><li>d</li></ul>
+</code></pre>
+</li>
+<li>d</li>
+</ul>
 >>> Lists - 292
 - a
 <<<
-<ul><li>a</li></ul>
+<ul>
+<li>a</li>
+</ul>
 >>> Lists - 293
 - a
   - b
 <<<
-<ul><li>a<ul><li>b</li></ul></li></ul>
+<ul>
+<li>a
+<ul>
+<li>b</li>
+</ul>
+</li>
+</ul>
 >>> Lists - 294
 1. ```
    foo
@@ -222,19 +355,28 @@
 
    bar
 <<<
-<ol><li>
+<ol>
+<li>
 <pre><code>foo
 </code></pre>
-<p>bar</p></li></ol>
+<p>bar</p>
+</li>
+</ol>
 >>> Lists - 295
 * foo
   * bar
 
   baz
 <<<
-<ul><li>
-<p>foo</p><ul><li>bar</li></ul>
-<p>baz</p></li></ul>
+<ul>
+<li>
+<p>foo</p>
+<ul>
+<li>bar</li>
+</ul>
+<p>baz</p>
+</li>
+</ul>
 >>> Lists - 296
 - a
   - b
@@ -244,6 +386,19 @@
   - e
   - f
 <<<
-<ul><li>
-<p>a</p><ul><li>b</li><li>c</li></ul></li><li>
-<p>d</p><ul><li>e</li><li>f</li></ul></li></ul>
+<ul>
+<li>
+<p>a</p>
+<ul>
+<li>b</li>
+<li>c</li>
+</ul>
+</li>
+<li>
+<p>d</p>
+<ul>
+<li>e</li>
+<li>f</li>
+</ul>
+</li>
+</ul>
diff --git a/test/common_mark/paragraphs.unit b/test/common_mark/paragraphs.unit
index 94eed50..2d80ea9 100644
--- a/test/common_mark/paragraphs.unit
+++ b/test/common_mark/paragraphs.unit
@@ -28,21 +28,21 @@
   aaa
  bbb
 <<<
-<p>  aaa
- bbb</p>
+<p>aaa
+bbb</p>
 >>> Paragraphs - 193
 aaa
              bbb
                                        ccc
 <<<
 <p>aaa
-             bbb
-                                       ccc</p>
+bbb
+ccc</p>
 >>> Paragraphs - 194
    aaa
 bbb
 <<<
-<p>   aaa
+<p>aaa
 bbb</p>
 >>> Paragraphs - 195
     aaa
diff --git a/test/common_mark/precedence.unit b/test/common_mark/precedence.unit
index e91d5c7..793a094 100644
--- a/test/common_mark/precedence.unit
+++ b/test/common_mark/precedence.unit
@@ -2,4 +2,7 @@
 - `one
 - two`
 <<<
-<ul><li>`one</li><li>two`</li></ul>
+<ul>
+<li>`one</li>
+<li>two`</li>
+</ul>
diff --git a/test/common_mark/raw_html.unit b/test/common_mark/raw_html.unit
index 97e51fb..3ec4071 100644
--- a/test/common_mark/raw_html.unit
+++ b/test/common_mark/raw_html.unit
@@ -25,7 +25,7 @@
 >>> Raw HTML - 614
 <33> <__>
 <<<
-<p>&lt;33> &lt;__></p>
+<p>&lt;33&gt; &lt;__&gt;</p>
 >>> Raw HTML - 615
 <a h*#ref="hi">
 <<<
@@ -40,8 +40,8 @@
 <foo bar=baz
 bim!bop />
 <<<
-<p>&lt; a>&lt;
-foo>&lt;bar/ >
+<p>&lt; a&gt;&lt;
+foo&gt;&lt;bar/ &gt;
 <foo bar=baz
 bim!bop /></p>
 >>> Raw HTML - 618
@@ -61,18 +61,18 @@
 comment - with hyphen -->
 <<<
 <p>foo &lt;!-- this is a
-comment - with hyphen --></p>
+comment - with hyphen --&gt;</p>
 >>> Raw HTML - 622
 foo <!-- not a comment -- two hyphens -->
 <<<
-<p>foo &lt;!-- not a comment -- two hyphens --></p>
+<p>foo &lt;!-- not a comment -- two hyphens --&gt;</p>
 >>> Raw HTML - 623
 foo <!--> foo -->
 
 foo <!-- foo--->
 <<<
-<p>foo &lt;!--> foo --></p>
-<p>foo &lt;!-- foo---></p>
+<p>foo &lt;!--&gt; foo --&gt;</p>
+<p>foo &lt;!-- foo---&gt;</p>
 >>> Raw HTML - 624
 foo <?php echo $a; ?>
 <<<
@@ -84,7 +84,7 @@
 >>> Raw HTML - 626
 foo <![CDATA[>&<]]>
 <<<
-<p>foo &lt;![CDATA[>&amp;&lt;]]></p>
+<p>foo &lt;![CDATA[&gt;&amp;&lt;]]&gt;</p>
 >>> Raw HTML - 627
 foo <a href="&ouml;">
 <<<
diff --git a/test/common_mark/setext_headings.unit b/test/common_mark/setext_headings.unit
index 14202eb..563018d 100644
--- a/test/common_mark/setext_headings.unit
+++ b/test/common_mark/setext_headings.unit
@@ -66,7 +66,7 @@
     ---
 <<<
 <p>Foo
-    ---</p>
+---</p>
 >>> Setext headings - 58
 Foo
 = =
@@ -106,7 +106,8 @@
 ---
 <<<
 <blockquote>
-<p>Foo</p></blockquote>
+<p>Foo</p>
+</blockquote>
 <hr />
 >>> Setext headings - 63
 > foo
@@ -114,13 +115,16 @@
 ===
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <h1>bar</h1>
 >>> Setext headings - 64
 - Foo
 ---
 <<<
-<ul><li>Foo</li></ul>
+<ul>
+<li>Foo</li>
+</ul>
 <hr />
 >>> Setext headings - 65
 Foo
@@ -156,7 +160,9 @@
 - foo
 -----
 <<<
-<ul><li>foo</li></ul>
+<ul>
+<li>foo</li>
+</ul>
 <hr />
 >>> Setext headings - 70
     foo
@@ -170,7 +176,8 @@
 -----
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <hr />
 >>> Setext headings - 72
 \> foo
diff --git a/test/common_mark/soft_line_breaks.unit b/test/common_mark/soft_line_breaks.unit
index 4a51dd0..5302f4e 100644
--- a/test/common_mark/soft_line_breaks.unit
+++ b/test/common_mark/soft_line_breaks.unit
@@ -9,4 +9,4 @@
  baz
 <<<
 <p>foo 
- baz</p>
+baz</p>
diff --git a/test/common_mark/tabs.unit b/test/common_mark/tabs.unit
index 97804f6..2796403 100644
--- a/test/common_mark/tabs.unit
+++ b/test/common_mark/tabs.unit
@@ -20,30 +20,40 @@
 
 	bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
-<p>bar</p></li></ul>
+<p>bar</p>
+</li>
+</ul>
 >>> Tabs - 5
 - foo
 
 		bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
 <pre><code>  bar
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> Tabs - 6
 >		foo
 <<<
 <blockquote>
 <pre><code>	foo
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 >>> Tabs - 7
 -		foo
 <<<
-<ul><li>
+<ul>
+<li>
 <pre><code>foo
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> Tabs - 8
     foo
 	bar
@@ -56,7 +66,17 @@
    - bar
 	 - baz
 <<<
-<ul><li>foo<ul><li>bar<ul><li>baz</li></ul></li></ul></li></ul>
+<ul>
+<li>foo
+<ul>
+<li>bar
+<ul>
+<li>baz</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
 >>> Tabs - 10
 #	Foo
 <<<
diff --git a/test/common_mark/thematic_breaks.unit b/test/common_mark/thematic_breaks.unit
index ed9fc50..85206c8 100644
--- a/test/common_mark/thematic_breaks.unit
+++ b/test/common_mark/thematic_breaks.unit
@@ -40,7 +40,7 @@
     ***
 <<<
 <p>Foo
-    ***</p>
+***</p>
 >>> Thematic breaks - 20
 _____________________________________
 <<<
@@ -74,14 +74,19 @@
 >>> Thematic breaks - 26
  *-*
 <<<
-<p> <em>-</em></p>
+<p><em>-</em></p>
 >>> Thematic breaks - 27
 - foo
 ***
 - bar
 <<<
-<ul><li>foo</li></ul>
-<hr /><ul><li>bar</li></ul>
+<ul>
+<li>foo</li>
+</ul>
+<hr />
+<ul>
+<li>bar</li>
+</ul>
 >>> Thematic breaks - 28
 Foo
 ***
@@ -102,11 +107,20 @@
 * * *
 * Bar
 <<<
-<ul><li>Foo</li></ul>
-<hr /><ul><li>Bar</li></ul>
+<ul>
+<li>Foo</li>
+</ul>
+<hr />
+<ul>
+<li>Bar</li>
+</ul>
 >>> Thematic breaks - 31
 - Foo
 - * * *
 <<<
-<ul><li>Foo</li><li>
-<hr /></li></ul>
+<ul>
+<li>Foo</li>
+<li>
+<hr />
+</li>
+</ul>
diff --git a/test/extensions/emojis.unit b/test/extensions/emojis.unit
index 142a5e5..00197e5 100644
--- a/test/extensions/emojis.unit
+++ b/test/extensions/emojis.unit
@@ -11,7 +11,8 @@
 > I love to :smile:.
 <<<
 <blockquote>
-<p>I love to 😄.</p></blockquote>
+<p>I love to 😄.</p>
+</blockquote>
 >>> within code block
     I love to :smile:
 <<<
diff --git a/test/extensions/inline_html.unit b/test/extensions/inline_html.unit
index 4aa260b..d02d1fd 100644
--- a/test/extensions/inline_html.unit
+++ b/test/extensions/inline_html.unit
@@ -8,8 +8,8 @@
 Not HTML: <3>, <_a>, <>
 
 <<<
-<p>Obviously, 3 &lt; 5 and 7 > 2.
-Not HTML: &lt;3>, &lt;_a>, &lt;></p>
+<p>Obviously, 3 &lt; 5 and 7 &gt; 2.
+Not HTML: &lt;3&gt;, &lt;_a&gt;, &lt;&gt;</p>
 >>> "markdown" within a tag is not parsed
 Text <a href="_foo_">And "_foo_"</a>.
 
diff --git a/test/gfm/atx_headings.unit b/test/gfm/atx_headings.unit
index 7813d9d..04e8d9f 100644
--- a/test/gfm/atx_headings.unit
+++ b/test/gfm/atx_headings.unit
@@ -53,7 +53,7 @@
     # bar
 <<<
 <p>foo
-    # bar</p>
+# bar</p>
 >>> ATX headings - 41
 ## foo ##
   ###   bar    ###
diff --git a/test/gfm/autolinks.unit b/test/gfm/autolinks.unit
index fb41afe..d4c803b 100644
--- a/test/gfm/autolinks.unit
+++ b/test/gfm/autolinks.unit
@@ -33,7 +33,7 @@
 >>> Autolinks - 610
 <http://foo.bar/baz bim>
 <<<
-<p>&lt;http://foo.bar/baz bim></p>
+<p>&lt;http://foo.bar/baz bim&gt;</p>
 >>> Autolinks - 611
 <http://example.com/\[\>
 <<<
@@ -49,23 +49,23 @@
 >>> Autolinks - 614
 <foo\+@bar.example.com>
 <<<
-<p>&lt;foo+@bar.example.com></p>
+<p>&lt;foo+@bar.example.com&gt;</p>
 >>> Autolinks - 615
 <>
 <<<
-<p>&lt;></p>
+<p>&lt;&gt;</p>
 >>> Autolinks - 616
 < http://foo.bar >
 <<<
-<p>&lt; <a href="http://foo.bar">http://foo.bar</a> ></p>
+<p>&lt; <a href="http://foo.bar">http://foo.bar</a> &gt;</p>
 >>> Autolinks - 617
 <m:abc>
 <<<
-<p>&lt;m:abc></p>
+<p>&lt;m:abc&gt;</p>
 >>> Autolinks - 618
 <foo.bar.baz>
 <<<
-<p>&lt;foo.bar.baz></p>
+<p>&lt;foo.bar.baz&gt;</p>
 >>> Autolinks - 619
 http://example.com
 <<<
diff --git a/test/gfm/block_quotes.unit b/test/gfm/block_quotes.unit
index 1f9a00b..87a3b72 100644
--- a/test/gfm/block_quotes.unit
+++ b/test/gfm/block_quotes.unit
@@ -6,7 +6,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 207
 ># Foo
 >bar
@@ -15,7 +16,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 208
    > # Foo
    > bar
@@ -24,7 +26,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 209
     > # Foo
     > bar
@@ -42,7 +45,8 @@
 <blockquote>
 <h1>Foo</h1>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 211
 > bar
 baz
@@ -51,26 +55,36 @@
 <blockquote>
 <p>bar
 baz
-foo</p></blockquote>
+foo</p>
+</blockquote>
 >>> Block quotes - 212
 > foo
 ---
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <hr />
 >>> Block quotes - 213
 > - foo
 - bar
 <<<
-<blockquote><ul><li>foo</li></ul></blockquote><ul><li>bar</li></ul>
+<blockquote>
+<ul>
+<li>foo</li>
+</ul>
+</blockquote>
+<ul>
+<li>bar</li>
+</ul>
 >>> Block quotes - 214
 >     foo
     bar
 <<<
 <blockquote>
 <pre><code>foo
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <pre><code>bar
 </code></pre>
 >>> Block quotes - 215
@@ -80,7 +94,8 @@
 <<<
 <blockquote>
 <pre><code>foo
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <pre><code>
 </code></pre>
 >>> Block quotes - 216
@@ -88,42 +103,49 @@
     - bar
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <pre><code>- bar
 </code></pre>
 >>> Block quotes - 217
 >
 <<<
-<blockquote></blockquote>
+<blockquote>
+</blockquote>
 >>> Block quotes - 218
 >
 >  
 > 
 <<<
-<blockquote></blockquote>
+<blockquote>
+</blockquote>
 >>> Block quotes - 219
 >
 > foo
 >  
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 >>> Block quotes - 220
 > foo
 
 > bar
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Block quotes - 221
 > foo
 > bar
 <<<
 <blockquote>
 <p>foo
-bar</p></blockquote>
+bar</p>
+</blockquote>
 >>> Block quotes - 222
 > foo
 >
@@ -131,38 +153,44 @@
 <<<
 <blockquote>
 <p>foo</p>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Block quotes - 223
 foo
 > bar
 <<<
 <p>foo</p>
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Block quotes - 224
 > aaa
 ***
 > bbb
 <<<
 <blockquote>
-<p>aaa</p></blockquote>
+<p>aaa</p>
+</blockquote>
 <hr />
 <blockquote>
-<p>bbb</p></blockquote>
+<p>bbb</p>
+</blockquote>
 >>> Block quotes - 225
 > bar
 baz
 <<<
 <blockquote>
 <p>bar
-baz</p></blockquote>
+baz</p>
+</blockquote>
 >>> Block quotes - 226
 > bar
 
 baz
 <<<
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 <p>baz</p>
 >>> Block quotes - 227
 > bar
@@ -171,7 +199,8 @@
 <<<
 <blockquote>
 <p>bar</p>
-<p>baz</p></blockquote>
+<p>baz</p>
+</blockquote>
 >>> Block quotes - 228
 > > > foo
 bar
@@ -180,7 +209,10 @@
 <blockquote>
 <blockquote>
 <p>foo
-bar</p></blockquote></blockquote></blockquote>
+bar</p>
+</blockquote>
+</blockquote>
+</blockquote>
 >>> Block quotes - 229
 >>> foo
 > bar
@@ -191,7 +223,10 @@
 <blockquote>
 <p>foo
 bar
-baz</p></blockquote></blockquote></blockquote>
+baz</p>
+</blockquote>
+</blockquote>
+</blockquote>
 >>> Block quotes - 230
 >     code
 
@@ -199,6 +234,8 @@
 <<<
 <blockquote>
 <pre><code>code
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <blockquote>
-<p>   not code</p></blockquote>
+<p>not code</p>
+</blockquote>
diff --git a/test/gfm/code_spans.unit b/test/gfm/code_spans.unit
index 7248dc5..6789f57 100644
--- a/test/gfm/code_spans.unit
+++ b/test/gfm/code_spans.unit
@@ -35,9 +35,7 @@
 baz
 ``
 <<<
-<p><code>foo
-bar  
-baz</code></p>
+<p><code>foo bar   baz</code></p>
 >>> Code spans - 346
 ``
 foo 
@@ -48,8 +46,7 @@
 `foo   bar 
 baz`
 <<<
-<p><code>foo   bar 
-baz</code></p>
+<p><code>foo   bar  baz</code></p>
 >>> Code spans - 348
 `foo\`bar`
 <<<
@@ -73,7 +70,7 @@
 >>> Code spans - 353
 `<a href="`">`
 <<<
-<p><code>&lt;a href="</code>">`</p>
+<p><code>&lt;a href="</code>"&gt;`</p>
 >>> Code spans - 354
 <a href="`">`
 <<<
@@ -81,7 +78,7 @@
 >>> Code spans - 355
 `<http://foo.bar.`baz>`
 <<<
-<p><code>&lt;http://foo.bar.</code>baz>`</p>
+<p><code>&lt;http://foo.bar.</code>baz&gt;`</p>
 >>> Code spans - 356
 <http://foo.bar.`baz>`
 <<<
diff --git a/test/gfm/disallowed_raw_html_extension.unit b/test/gfm/disallowed_raw_html_extension.unit
index c8960f6..cef4e62 100644
--- a/test/gfm/disallowed_raw_html_extension.unit
+++ b/test/gfm/disallowed_raw_html_extension.unit
@@ -6,5 +6,5 @@
 </blockquote>
 <<<
 <p><strong> <title> <style> <em></p><blockquote>
-  <xmp> is disallowed.  <XMP> is also disallowed.
+<xmp> is disallowed.  <XMP> is also disallowed.
 </blockquote>
diff --git a/test/gfm/emphasis_and_strong_emphasis.unit b/test/gfm/emphasis_and_strong_emphasis.unit
index 47ba27d..33f407b 100644
--- a/test/gfm/emphasis_and_strong_emphasis.unit
+++ b/test/gfm/emphasis_and_strong_emphasis.unit
@@ -66,7 +66,10 @@
 *foo bar
 *
 <<<
-<p>*foo bar</p><ul><li></li></ul>
+<p>*foo bar</p>
+<ul>
+<li></li>
+</ul>
 >>> Emphasis and strong emphasis - 377
 *(*foo)
 <<<
diff --git a/test/gfm/entity_and_numeric_character_references.unit b/test/gfm/entity_and_numeric_character_references.unit
index fbc2b1b..5405ac2 100644
--- a/test/gfm/entity_and_numeric_character_references.unit
+++ b/test/gfm/entity_and_numeric_character_references.unit
@@ -73,7 +73,10 @@
 
 * foo
 <<<
-<p>&#42; foo</p><ul><li>foo</li></ul>
+<p>&#42; foo</p>
+<ul>
+<li>foo</li>
+</ul>
 >>> Entity and numeric character references - 335
 foo&#10;&#10;bar
 <<<
diff --git a/test/gfm/fenced_code_blocks.unit b/test/gfm/fenced_code_blocks.unit
index b6ca0ab..2e30524 100644
--- a/test/gfm/fenced_code_blocks.unit
+++ b/test/gfm/fenced_code_blocks.unit
@@ -82,7 +82,8 @@
 <<<
 <blockquote>
 <pre><code>aaa
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 <p>bbb</p>
 >>> Fenced code blocks - 99
 ```
diff --git a/test/gfm/hard_line_breaks.unit b/test/gfm/hard_line_breaks.unit
index 78ca62b..b9d24e5 100644
--- a/test/gfm/hard_line_breaks.unit
+++ b/test/gfm/hard_line_breaks.unit
@@ -44,14 +44,12 @@
 `code 
 span`
 <<<
-<p><code>code 
-span</code></p>
+<p><code>code  span</code></p>
 >>> Hard line breaks - 662
 `code\
 span`
 <<<
-<p><code>code\
-span</code></p>
+<p><code>code\ span</code></p>
 >>> Hard line breaks - 663
 <a href="foo  
 bar">
diff --git a/test/gfm/html_blocks.unit b/test/gfm/html_blocks.unit
index 0f73985..ab15985 100644
--- a/test/gfm/html_blocks.unit
+++ b/test/gfm/html_blocks.unit
@@ -234,13 +234,17 @@
 bar
 <<<
 <blockquote><div>
-foo</blockquote>
+foo
+</blockquote>
 <p>bar</p>
 >>> HTML blocks - 144
 - <div>
 - foo
 <<<
-<ul><li><div></li><li>foo</li></ul>
+<ul>
+<li><div></li>
+<li>foo</li>
+</ul>
 >>> HTML blocks - 145
 <style>p{color:red;}</style>
 *foo*
diff --git a/test/gfm/indented_code_blocks.unit b/test/gfm/indented_code_blocks.unit
index dd7cf87..0dffa1d 100644
--- a/test/gfm/indented_code_blocks.unit
+++ b/test/gfm/indented_code_blocks.unit
@@ -10,16 +10,25 @@
 
     bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
-<p>bar</p></li></ul>
+<p>bar</p>
+</li>
+</ul>
 >>> Indented code blocks - 79
 1.  foo
 
     - bar
 <<<
-<ol><li>
-<p> foo</p><ul><li>bar</li></ul></li></ol>
+<ol>
+<li>
+<p>foo</p>
+<ul>
+<li>bar</li>
+</ul>
+</li>
+</ol>
 >>> Indented code blocks - 80
     <a/>
     *hi*
@@ -61,7 +70,7 @@
 
 <<<
 <p>Foo
-    bar</p>
+bar</p>
 >>> Indented code blocks - 84
     foo
 bar
diff --git a/test/gfm/link_reference_definitions.unit b/test/gfm/link_reference_definitions.unit
index 88fa981..388ed8d 100644
--- a/test/gfm/link_reference_definitions.unit
+++ b/test/gfm/link_reference_definitions.unit
@@ -165,7 +165,8 @@
 <<<
 <h1><a href="/url">Foo</a></h1>
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Link reference definitions - 184
 [foo]: /url
 bar
@@ -201,7 +202,8 @@
 > [foo]: /url
 <<<
 <p><a href="/url">foo</a></p>
-<blockquote></blockquote>
+<blockquote>
+</blockquote>
 >>> Link reference definitions - 188
 [foo]: /url
 <<<
diff --git a/test/gfm/links.unit b/test/gfm/links.unit
index 357a4fa..a64166a 100644
--- a/test/gfm/links.unit
+++ b/test/gfm/links.unit
@@ -48,7 +48,7 @@
 [a](<b>c)
 <<<
 <p>[a](&lt;b)c
-[a](&lt;b)c>
+[a](&lt;b)c&gt;
 [a](<b>c)</p>
 >>> Links - 504
 [link](\(foo\))
diff --git a/test/gfm/list_items.unit b/test/gfm/list_items.unit
index 549d7a9..90ff27f 100644
--- a/test/gfm/list_items.unit
+++ b/test/gfm/list_items.unit
@@ -11,7 +11,8 @@
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote>
+<p>A block quote.</p>
+</blockquote>
 >>> List items - 232
 1.  A paragraph
     with two lines.
@@ -20,34 +21,45 @@
 
     > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 233
 - one
 
  two
 <<<
-<ul><li>one</li></ul>
-<p> two</p>
+<ul>
+<li>one</li>
+</ul>
+<p>two</p>
 >>> List items - 234
 - one
 
   two
 <<<
-<ul><li>
+<ul>
+<li>
 <p>one</p>
-<p>two</p></li></ul>
+<p>two</p>
+</li>
+</ul>
 >>> List items - 235
  -    one
 
      two
 <<<
-<ul><li>   one</li></ul>
+<ul>
+<li>one</li>
+</ul>
 <pre><code> two
 </code></pre>
 >>> List items - 236
@@ -55,26 +67,40 @@
 
       two
 <<<
-<ul><li>
-<p>   one</p>
-<p>two</p></li></ul>
+<ul>
+<li>
+<p>one</p>
+<p>two</p>
+</li>
+</ul>
 >>> List items - 237
    > > 1.  one
 >>
 >>     two
 <<<
 <blockquote>
-<blockquote><ol><li>
-<p> one</p>
-<p>two</p></li></ol></blockquote></blockquote>
+<blockquote>
+<ol>
+<li>
+<p>one</p>
+<p>two</p>
+</li>
+</ol>
+</blockquote>
+</blockquote>
 >>> List items - 238
 >>- one
 >>
   >  > two
 <<<
 <blockquote>
-<blockquote><ul><li>one</li></ul>
-<p>two</p></blockquote></blockquote>
+<blockquote>
+<ul>
+<li>one</li>
+</ul>
+<p>two</p>
+</blockquote>
+</blockquote>
 >>> List items - 239
 -one
 
@@ -88,8 +114,10 @@
 
   bar
 <<<
-<ul><li>foo</li></ul>
-<p>  bar</p>
+<ul>
+<li>foo</li>
+</ul>
+<p>bar</p>
 >>> List items - 241
 1.  foo
 
@@ -101,13 +129,17 @@
 
     > bam
 <<<
-<ol><li>
-<p> foo</p>
+<ol>
+<li>
+<p>foo</p>
 <pre><code>bar
 </code></pre>
 <p>baz</p>
 <blockquote>
-<p>bam</p></blockquote></li></ol>
+<p>bam</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 242
 - Foo
 
@@ -116,16 +148,21 @@
 
       baz
 <<<
-<ul><li>
+<ul>
+<li>
 <p>Foo</p>
 <pre><code>bar
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 <pre><code>  baz
 </code></pre>
 >>> List items - 243
 123456789. ok
 <<<
-<ol start="123456789"><li>ok</li></ol>
+<ol start="123456789">
+<li>ok</li>
+</ol>
 >>> List items - 244
 1234567890. not ok
 <<<
@@ -133,11 +170,15 @@
 >>> List items - 245
 0. ok
 <<<
-<ol start="0"><li>ok</li></ol>
+<ol start="0">
+<li>ok</li>
+</ol>
 >>> List items - 246
 003. ok
 <<<
-<ol start="3"><li>ok</li></ol>
+<ol start="3">
+<li>ok</li>
+</ol>
 >>> List items - 247
 -1. not ok
 <<<
@@ -147,19 +188,25 @@
 
       bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
 <pre><code>bar
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> List items - 249
   10.  foo
 
            bar
 <<<
-<ol start="10"><li>
-<p> foo</p>
+<ol start="10">
+<li>
+<p>foo</p>
 <pre><code>bar
-</code></pre></li></ol>
+</code></pre>
+</li>
+</ol>
 >>> List items - 250
     indented code
 
@@ -179,12 +226,15 @@
 
        more code
 <<<
-<ol><li>
+<ol>
+<li>
 <pre><code>indented code
 </code></pre>
 <p>paragraph</p>
 <pre><code>more code
-</code></pre></li></ol>
+</code></pre>
+</li>
+</ol>
 >>> List items - 252
 1.      indented code
 
@@ -192,34 +242,42 @@
 
        more code
 <<<
-<ol><li>
+<ol>
+<li>
 <pre><code> indented code
 </code></pre>
 <p>paragraph</p>
 <pre><code>more code
-</code></pre></li></ol>
+</code></pre>
+</li>
+</ol>
 >>> List items - 253
    foo
 
 bar
 <<<
-<p>   foo</p>
+<p>foo</p>
 <p>bar</p>
 >>> List items - 254
 -    foo
 
   bar
 <<<
-<ul><li>   foo</li></ul>
-<p>  bar</p>
+<ul>
+<li>foo</li>
+</ul>
+<p>bar</p>
 >>> List items - 255
 -  foo
 
    bar
 <<<
-<ul><li>
-<p> foo</p>
-<p>bar</p></li></ul>
+<ul>
+<li>
+<p>foo</p>
+<p>bar</p>
+</li>
+</ul>
 >>> List items - 256
 -
   foo
@@ -230,45 +288,70 @@
 -
       baz
 <<<
-<ul><li>foo</li><li>
+<ul>
+<li>foo</li>
+<li>
 <pre><code>bar
-</code></pre></li><li>
+</code></pre>
+</li>
+<li>
 <pre><code>baz
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> List items - 257
 -   
   foo
 <<<
-<ul><li>foo</li></ul>
+<ul>
+<li>foo</li>
+</ul>
 >>> List items - 258
 -
 
   foo
 <<<
-<ul><li>
-<p>foo</p></li></ul>
+<ul>
+<li>
+<p>foo</p>
+</li>
+</ul>
 >>> List items - 259
 - foo
 -
 - bar
 <<<
-<ul><li>foo</li><li></li><li>bar</li></ul>
+<ul>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ul>
 >>> List items - 260
 - foo
 -   
 - bar
 <<<
-<ul><li>foo</li><li></li><li>bar</li></ul>
+<ul>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ul>
 >>> List items - 261
 1. foo
 2.
 3. bar
 <<<
-<ol><li>foo</li><li></li><li>bar</li></ol>
+<ol>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ol>
 >>> List items - 262
 *
 <<<
-<ul><li></li></ul>
+<ul>
+<li></li>
+</ul>
 >>> List items - 263
 foo
 *
@@ -276,8 +359,14 @@
 foo
 1.
 <<<
-<p>foo</p><ul><li></li></ul>
-<p>foo</p><ol><li></li></ol>
+<p>foo</p>
+<ul>
+<li></li>
+</ul>
+<p>foo</p>
+<ol>
+<li></li>
+</ol>
 >>> List items - 264
  1.  A paragraph
      with two lines.
@@ -286,13 +375,17 @@
 
      > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 265
   1.  A paragraph
       with two lines.
@@ -301,13 +394,17 @@
 
       > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 266
    1.  A paragraph
        with two lines.
@@ -316,13 +413,17 @@
 
        > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 267
     1.  A paragraph
         with two lines.
@@ -346,73 +447,141 @@
 
       > A block quote.
 <<<
-<ol><li>
-<p> A paragraph
+<ol>
+<li>
+<p>A paragraph
 with two lines.</p>
 <pre><code>indented code
 </code></pre>
 <blockquote>
-<p>A block quote.</p></blockquote></li></ol>
+<p>A block quote.</p>
+</blockquote>
+</li>
+</ol>
 >>> List items - 269
   1.  A paragraph
     with two lines.
 <<<
-<ol><li> A paragraph
-    with two lines.</li></ol>
+<ol>
+<li>A paragraph
+with two lines.</li>
+</ol>
 >>> List items - 270
 > 1. > Blockquote
 continued here.
 <<<
-<blockquote><ol><li>
+<blockquote>
+<ol>
+<li>
 <blockquote>
 <p>Blockquote
-continued here.</p></blockquote></li></ol></blockquote>
+continued here.</p>
+</blockquote>
+</li>
+</ol>
+</blockquote>
 >>> List items - 271
 > 1. > Blockquote
 > continued here.
 <<<
-<blockquote><ol><li>
+<blockquote>
+<ol>
+<li>
 <blockquote>
 <p>Blockquote
-continued here.</p></blockquote></li></ol></blockquote>
+continued here.</p>
+</blockquote>
+</li>
+</ol>
+</blockquote>
 >>> List items - 272
 - foo
   - bar
     - baz
       - boo
 <<<
-<ul><li>foo<ul><li>bar<ul><li>baz<ul><li>boo</li></ul></li></ul></li></ul></li></ul>
+<ul>
+<li>foo
+<ul>
+<li>bar
+<ul>
+<li>baz
+<ul>
+<li>boo</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
 >>> List items - 273
 - foo
  - bar
   - baz
    - boo
 <<<
-<ul><li>foo</li><li>bar</li><li>baz</li><li>boo</li></ul>
+<ul>
+<li>foo</li>
+<li>bar</li>
+<li>baz</li>
+<li>boo</li>
+</ul>
 >>> List items - 274
 10) foo
     - bar
 <<<
-<ol start="10"><li>foo<ul><li>bar</li></ul></li></ol>
+<ol start="10">
+<li>foo
+<ul>
+<li>bar</li>
+</ul>
+</li>
+</ol>
 >>> List items - 275
 10) foo
    - bar
 <<<
-<ol start="10"><li>foo</li></ol><ul><li>bar</li></ul>
+<ol start="10">
+<li>foo</li>
+</ol>
+<ul>
+<li>bar</li>
+</ul>
 >>> List items - 276
 - - foo
 <<<
-<ul><li><ul><li>foo</li></ul></li></ul>
+<ul>
+<li>
+<ul>
+<li>foo</li>
+</ul>
+</li>
+</ul>
 >>> List items - 277
 1. - 2. foo
 <<<
-<ol><li><ul><li><ol start="2"><li>foo</li></ol></li></ul></li></ol>
+<ol>
+<li>
+<ul>
+<li>
+<ol start="2">
+<li>foo</li>
+</ol>
+</li>
+</ul>
+</li>
+</ol>
 >>> List items - 278
 - # Foo
 - Bar
   ---
   baz
 <<<
-<ul><li>
-<h1>Foo</h1></li><li>
-<h2>Bar</h2>baz</li></ul>
+<ul>
+<li>
+<h1>Foo</h1>
+</li>
+<li>
+<h2>Bar</h2>baz</li>
+</ul>
diff --git a/test/gfm/lists.unit b/test/gfm/lists.unit
index b16d05f..6a6e847 100644
--- a/test/gfm/lists.unit
+++ b/test/gfm/lists.unit
@@ -3,29 +3,51 @@
 - bar
 + baz
 <<<
-<ul><li>foo</li><li>bar</li></ul><ul><li>baz</li></ul>
+<ul>
+<li>foo</li>
+<li>bar</li>
+</ul>
+<ul>
+<li>baz</li>
+</ul>
 >>> Lists - 282
 1. foo
 2. bar
 3) baz
 <<<
-<ol><li>foo</li><li>bar</li></ol><ol start="3"><li>baz</li></ol>
+<ol>
+<li>foo</li>
+<li>bar</li>
+</ol>
+<ol start="3">
+<li>baz</li>
+</ol>
 >>> Lists - 283
 Foo
 - bar
 - baz
 <<<
-<p>Foo</p><ul><li>bar</li><li>baz</li></ul>
+<p>Foo</p>
+<ul>
+<li>bar</li>
+<li>baz</li>
+</ul>
 >>> Lists - 284
 The number of windows in my house is
 14.  The number of doors is 6.
 <<<
-<p>The number of windows in my house is</p><ol start="14"><li> The number of doors is 6.</li></ol>
+<p>The number of windows in my house is</p>
+<ol start="14">
+<li>The number of doors is 6.</li>
+</ol>
 >>> Lists - 285
 The number of windows in my house is
 1.  The number of doors is 6.
 <<<
-<p>The number of windows in my house is</p><ol><li> The number of doors is 6.</li></ol>
+<p>The number of windows in my house is</p>
+<ol>
+<li>The number of doors is 6.</li>
+</ol>
 >>> Lists - 286
 - foo
 
@@ -34,9 +56,17 @@
 
 - baz
 <<<
-<ul><li>
-<p>foo</p></li><li>
-<p>bar</p></li></ul><ul><li>baz</li></ul>
+<ul>
+<li>
+<p>foo</p>
+</li>
+<li>
+<p>bar</p>
+</li>
+</ul>
+<ul>
+<li>baz</li>
+</ul>
 >>> Lists - 287
 - foo
   - bar
@@ -45,7 +75,17 @@
 
       bim
 <<<
-<ul><li>foo<ul><li>bar<ul><li>baz</li></ul></li></ul></li></ul>
+<ul>
+<li>foo
+<ul>
+<li>bar
+<ul>
+<li>baz</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
 <pre><code>  bim
 </code></pre>
 >>> Lists - 288
@@ -57,7 +97,14 @@
 - baz
 - bim
 <<<
-<ul><li>foo</li><li>bar</li></ul><!-- --><ul><li>baz</li><li>bim</li></ul>
+<ul>
+<li>foo</li>
+<li>bar</li>
+</ul><!-- -->
+<ul>
+<li>baz</li>
+<li>bim</li>
+</ul>
 >>> Lists - 289
 -   foo
 
@@ -69,10 +116,15 @@
 
     code
 <<<
-<ul><li>
-<p>  foo</p>
-<p>notcode</p></li><li>
-<p>  foo</p></li></ul><!-- -->
+<ul>
+<li>
+<p>foo</p>
+<p>notcode</p>
+</li>
+<li>
+<p>foo</p>
+</li>
+</ul><!-- -->
 <pre><code>code
 </code></pre>
 >>> Lists - 290
@@ -84,7 +136,15 @@
  - f
 - g
 <<<
-<ul><li>a</li><li>b</li><li>c</li><li>d</li><li>e</li><li>f</li><li>g</li></ul>
+<ul>
+<li>a</li>
+<li>b</li>
+<li>c</li>
+<li>d</li>
+<li>e</li>
+<li>f</li>
+<li>g</li>
+</ul>
 >>> Lists - 291
 1. a
 
@@ -92,10 +152,17 @@
 
    3. c
 <<<
-<ol><li>
-<p>a</p></li><li>
-<p>b</p></li><li>
-<p>c</p></li></ol>
+<ol>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p>
+</li>
+<li>
+<p>c</p>
+</li>
+</ol>
 >>> Lists - 292
 - a
  - b
@@ -103,8 +170,13 @@
    - d
     - e
 <<<
-<ul><li>a</li><li>b</li><li>c</li><li>d
-    - e</li></ul>
+<ul>
+<li>a</li>
+<li>b</li>
+<li>c</li>
+<li>d
+- e</li>
+</ul>
 >>> Lists - 293
 1. a
 
@@ -112,9 +184,14 @@
 
     3. c
 <<<
-<ol><li>
-<p>a</p></li><li>
-<p>b</p></li></ol>
+<ol>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p>
+</li>
+</ol>
 <pre><code>3. c
 </code></pre>
 >>> Lists - 294
@@ -123,19 +200,32 @@
 
 - c
 <<<
-<ul><li>
-<p>a</p></li><li>
-<p>b</p></li><li>
-<p>c</p></li></ul>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p>
+</li>
+<li>
+<p>c</p>
+</li>
+</ul>
 >>> Lists - 295
 * a
 *
 
 * c
 <<<
-<ul><li>
-<p>a</p></li><li></li><li>
-<p>c</p></li></ul>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li></li>
+<li>
+<p>c</p>
+</li>
+</ul>
 >>> Lists - 296
 - a
 - b
@@ -143,11 +233,18 @@
   c
 - d
 <<<
-<ul><li>
-<p>a</p></li><li>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li>
 <p>b</p>
-<p>c</p></li><li>
-<p>d</p></li></ul>
+<p>c</p>
+</li>
+<li>
+<p>d</p>
+</li>
+</ul>
 >>> Lists - 297
 - a
 - b
@@ -155,10 +252,16 @@
   [ref]: /url
 - d
 <<<
-<ul><li>
-<p>a</p></li><li>
-<p>b</p></li><li>
-<p>d</p></li></ul>
+<ul>
+<li>
+<p>a</p>
+</li>
+<li>
+<p>b</p></li>
+<li>
+<p>d</p>
+</li>
+</ul>
 >>> Lists - 298
 - a
 - ```
@@ -168,9 +271,13 @@
   ```
 - c
 <<<
-<ul><li>a</li><li>
+<ul>
+<li>a</li>
+<li>
 <pre><code>b
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 <pre><code>- c
 
 </code></pre>
@@ -181,18 +288,31 @@
     c
 - d
 <<<
-<ul><li>a<ul><li>
+<ul>
+<li>a
+<ul>
+<li>
 <p>b</p>
-<p>c</p></li></ul></li><li>d</li></ul>
+<p>c</p>
+</li>
+</ul>
+</li>
+<li>d</li>
+</ul>
 >>> Lists - 300
 * a
   > b
   >
 * c
 <<<
-<ul><li>a
+<ul>
+<li>a
 <blockquote>
-<p>b</p></blockquote></li><li>c</li></ul>
+<p>b</p>
+</blockquote>
+</li>
+<li>c</li>
+</ul>
 >>> Lists - 301
 - a
   > b
@@ -201,20 +321,33 @@
   ```
 - d
 <<<
-<ul><li>a
+<ul>
+<li>a
 <blockquote>
-<p>b</p></blockquote>
+<p>b</p>
+</blockquote>
 <pre><code>c
-</code></pre></li><li>d</li></ul>
+</code></pre>
+</li>
+<li>d</li>
+</ul>
 >>> Lists - 302
 - a
 <<<
-<ul><li>a</li></ul>
+<ul>
+<li>a</li>
+</ul>
 >>> Lists - 303
 - a
   - b
 <<<
-<ul><li>a<ul><li>b</li></ul></li></ul>
+<ul>
+<li>a
+<ul>
+<li>b</li>
+</ul>
+</li>
+</ul>
 >>> Lists - 304
 1. ```
    foo
@@ -222,19 +355,28 @@
 
    bar
 <<<
-<ol><li>
+<ol>
+<li>
 <pre><code>foo
 </code></pre>
-<p>bar</p></li></ol>
+<p>bar</p>
+</li>
+</ol>
 >>> Lists - 305
 * foo
   * bar
 
   baz
 <<<
-<ul><li>
-<p>foo</p><ul><li>bar</li></ul>
-<p>baz</p></li></ul>
+<ul>
+<li>
+<p>foo</p>
+<ul>
+<li>bar</li>
+</ul>
+<p>baz</p>
+</li>
+</ul>
 >>> Lists - 306
 - a
   - b
@@ -244,6 +386,19 @@
   - e
   - f
 <<<
-<ul><li>
-<p>a</p><ul><li>b</li><li>c</li></ul></li><li>
-<p>d</p><ul><li>e</li><li>f</li></ul></li></ul>
+<ul>
+<li>
+<p>a</p>
+<ul>
+<li>b</li>
+<li>c</li>
+</ul>
+</li>
+<li>
+<p>d</p>
+<ul>
+<li>e</li>
+<li>f</li>
+</ul>
+</li>
+</ul>
diff --git a/test/gfm/paragraphs.unit b/test/gfm/paragraphs.unit
index 94eed50..2d80ea9 100644
--- a/test/gfm/paragraphs.unit
+++ b/test/gfm/paragraphs.unit
@@ -28,21 +28,21 @@
   aaa
  bbb
 <<<
-<p>  aaa
- bbb</p>
+<p>aaa
+bbb</p>
 >>> Paragraphs - 193
 aaa
              bbb
                                        ccc
 <<<
 <p>aaa
-             bbb
-                                       ccc</p>
+bbb
+ccc</p>
 >>> Paragraphs - 194
    aaa
 bbb
 <<<
-<p>   aaa
+<p>aaa
 bbb</p>
 >>> Paragraphs - 195
     aaa
diff --git a/test/gfm/precedence.unit b/test/gfm/precedence.unit
index e91d5c7..793a094 100644
--- a/test/gfm/precedence.unit
+++ b/test/gfm/precedence.unit
@@ -2,4 +2,7 @@
 - `one
 - two`
 <<<
-<ul><li>`one</li><li>two`</li></ul>
+<ul>
+<li>`one</li>
+<li>two`</li>
+</ul>
diff --git a/test/gfm/raw_html.unit b/test/gfm/raw_html.unit
index 20bd566..f693be6 100644
--- a/test/gfm/raw_html.unit
+++ b/test/gfm/raw_html.unit
@@ -25,7 +25,7 @@
 >>> Raw HTML - 637
 <33> <__>
 <<<
-<p>&lt;33> &lt;__></p>
+<p>&lt;33&gt; &lt;__&gt;</p>
 >>> Raw HTML - 638
 <a h*#ref="hi">
 <<<
@@ -40,8 +40,8 @@
 <foo bar=baz
 bim!bop />
 <<<
-<p>&lt; a>&lt;
-foo>&lt;bar/ >
+<p>&lt; a&gt;&lt;
+foo&gt;&lt;bar/ &gt;
 <foo bar=baz
 bim!bop /></p>
 >>> Raw HTML - 641
@@ -61,18 +61,18 @@
 comment - with hyphen -->
 <<<
 <p>foo &lt;!-- this is a
-comment - with hyphen --></p>
+comment - with hyphen --&gt;</p>
 >>> Raw HTML - 645
 foo <!-- not a comment -- two hyphens -->
 <<<
-<p>foo &lt;!-- not a comment -- two hyphens --></p>
+<p>foo &lt;!-- not a comment -- two hyphens --&gt;</p>
 >>> Raw HTML - 646
 foo <!--> foo -->
 
 foo <!-- foo--->
 <<<
-<p>foo &lt;!--> foo --></p>
-<p>foo &lt;!-- foo---></p>
+<p>foo &lt;!--&gt; foo --&gt;</p>
+<p>foo &lt;!-- foo---&gt;</p>
 >>> Raw HTML - 647
 foo <?php echo $a; ?>
 <<<
@@ -84,7 +84,7 @@
 >>> Raw HTML - 649
 foo <![CDATA[>&<]]>
 <<<
-<p>foo &lt;![CDATA[>&amp;&lt;]]></p>
+<p>foo &lt;![CDATA[&gt;&amp;&lt;]]&gt;</p>
 >>> Raw HTML - 650
 foo <a href="&ouml;">
 <<<
diff --git a/test/gfm/setext_headings.unit b/test/gfm/setext_headings.unit
index 14202eb..563018d 100644
--- a/test/gfm/setext_headings.unit
+++ b/test/gfm/setext_headings.unit
@@ -66,7 +66,7 @@
     ---
 <<<
 <p>Foo
-    ---</p>
+---</p>
 >>> Setext headings - 58
 Foo
 = =
@@ -106,7 +106,8 @@
 ---
 <<<
 <blockquote>
-<p>Foo</p></blockquote>
+<p>Foo</p>
+</blockquote>
 <hr />
 >>> Setext headings - 63
 > foo
@@ -114,13 +115,16 @@
 ===
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <h1>bar</h1>
 >>> Setext headings - 64
 - Foo
 ---
 <<<
-<ul><li>Foo</li></ul>
+<ul>
+<li>Foo</li>
+</ul>
 <hr />
 >>> Setext headings - 65
 Foo
@@ -156,7 +160,9 @@
 - foo
 -----
 <<<
-<ul><li>foo</li></ul>
+<ul>
+<li>foo</li>
+</ul>
 <hr />
 >>> Setext headings - 70
     foo
@@ -170,7 +176,8 @@
 -----
 <<<
 <blockquote>
-<p>foo</p></blockquote>
+<p>foo</p>
+</blockquote>
 <hr />
 >>> Setext headings - 72
 \> foo
diff --git a/test/gfm/soft_line_breaks.unit b/test/gfm/soft_line_breaks.unit
index 180b633..00f2f86 100644
--- a/test/gfm/soft_line_breaks.unit
+++ b/test/gfm/soft_line_breaks.unit
@@ -9,4 +9,4 @@
  baz
 <<<
 <p>foo 
- baz</p>
+baz</p>
diff --git a/test/gfm/tables_extension.unit b/test/gfm/tables_extension.unit
index ce91028..cd84708 100644
--- a/test/gfm/tables_extension.unit
+++ b/test/gfm/tables_extension.unit
@@ -25,7 +25,8 @@
 <<<
 <table><thead><tr><th>abc</th><th>def</th></tr></thead><tbody><tr><td>bar</td><td>baz</td></tr></tbody></table>
 <blockquote>
-<p>bar</p></blockquote>
+<p>bar</p>
+</blockquote>
 >>> Tables (extension) - 202
 | abc | def |
 | --- | --- |
diff --git a/test/gfm/tabs.unit b/test/gfm/tabs.unit
index 97804f6..2796403 100644
--- a/test/gfm/tabs.unit
+++ b/test/gfm/tabs.unit
@@ -20,30 +20,40 @@
 
 	bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
-<p>bar</p></li></ul>
+<p>bar</p>
+</li>
+</ul>
 >>> Tabs - 5
 - foo
 
 		bar
 <<<
-<ul><li>
+<ul>
+<li>
 <p>foo</p>
 <pre><code>  bar
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> Tabs - 6
 >		foo
 <<<
 <blockquote>
 <pre><code>	foo
-</code></pre></blockquote>
+</code></pre>
+</blockquote>
 >>> Tabs - 7
 -		foo
 <<<
-<ul><li>
+<ul>
+<li>
 <pre><code>foo
-</code></pre></li></ul>
+</code></pre>
+</li>
+</ul>
 >>> Tabs - 8
     foo
 	bar
@@ -56,7 +66,17 @@
    - bar
 	 - baz
 <<<
-<ul><li>foo<ul><li>bar<ul><li>baz</li></ul></li></ul></li></ul>
+<ul>
+<li>foo
+<ul>
+<li>bar
+<ul>
+<li>baz</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
 >>> Tabs - 10
 #	Foo
 <<<
diff --git a/test/gfm/thematic_breaks.unit b/test/gfm/thematic_breaks.unit
index ed9fc50..85206c8 100644
--- a/test/gfm/thematic_breaks.unit
+++ b/test/gfm/thematic_breaks.unit
@@ -40,7 +40,7 @@
     ***
 <<<
 <p>Foo
-    ***</p>
+***</p>
 >>> Thematic breaks - 20
 _____________________________________
 <<<
@@ -74,14 +74,19 @@
 >>> Thematic breaks - 26
  *-*
 <<<
-<p> <em>-</em></p>
+<p><em>-</em></p>
 >>> Thematic breaks - 27
 - foo
 ***
 - bar
 <<<
-<ul><li>foo</li></ul>
-<hr /><ul><li>bar</li></ul>
+<ul>
+<li>foo</li>
+</ul>
+<hr />
+<ul>
+<li>bar</li>
+</ul>
 >>> Thematic breaks - 28
 Foo
 ***
@@ -102,11 +107,20 @@
 * * *
 * Bar
 <<<
-<ul><li>Foo</li></ul>
-<hr /><ul><li>Bar</li></ul>
+<ul>
+<li>Foo</li>
+</ul>
+<hr />
+<ul>
+<li>Bar</li>
+</ul>
 >>> Thematic breaks - 31
 - Foo
 - * * *
 <<<
-<ul><li>Foo</li><li>
-<hr /></li></ul>
+<ul>
+<li>Foo</li>
+<li>
+<hr />
+</li>
+</ul>
diff --git a/test/original/block_quotes.unit b/test/original/block_quotes.unit
index 2d0d559..ac20218 100644
--- a/test/original/block_quotes.unit
+++ b/test/original/block_quotes.unit
@@ -3,7 +3,8 @@
 
 <<<
 <blockquote>
-<p>blah</p></blockquote>
+<p>blah</p>
+</blockquote>
 >>> with two paragraphs
 > first
 >
@@ -12,7 +13,8 @@
 <<<
 <blockquote>
 <p>first</p>
-<p>second</p></blockquote>
+<p>second</p>
+</blockquote>
 >>> nested
 > one
 >> two
@@ -24,19 +26,24 @@
 <blockquote>
 <p>two</p>
 <blockquote>
-<p>three</p></blockquote></blockquote></blockquote>
+<p>three</p>
+</blockquote>
+</blockquote>
+</blockquote>
 >>> qoute with lazy continuation
 > quote
 text
 <<<
 <blockquote>
 <p>quote
-text</p></blockquote>
+text</p>
+</blockquote>
 >>> quote turns what might be an h2 into an hr
 > quote
 ---
 
 <<<
 <blockquote>
-<p>quote</p></blockquote>
+<p>quote</p>
+</blockquote>
 <hr />
diff --git a/test/original/hard_line_breaks.unit b/test/original/hard_line_breaks.unit
index 232079c..c8d1626 100644
--- a/test/original/hard_line_breaks.unit
+++ b/test/original/hard_line_breaks.unit
@@ -17,26 +17,24 @@
 code`.
 
 <<<
-<p><code>Some\
-code</code>.</p>
+<p><code>Some\ code</code>.</p>
 >>> hard line break in a paragraph, using trailing spaces
-First line.  
+First line.
 Second line.
 
 <<<
-<p>First line.<br />
+<p>First line.
 Second line.</p>
 >>> within emphasis, using trailing spaces
-*Emphasised  
+*Emphasised
 text.*
 
 <<<
-<p><em>Emphasised<br />
+<p><em>Emphasised
 text.</em></p>
 >>> no escape within code, using trailing spaces
-`Some  
+`Some
 code`.
 
 <<<
-<p><code>Some  
-code</code>.</p>
+<p><code>Some code</code>.</p>
diff --git a/test/original/html_encoding.unit b/test/original/html_encoding.unit
index 9333783..dab9043 100644
--- a/test/original/html_encoding.unit
+++ b/test/original/html_encoding.unit
@@ -3,11 +3,11 @@
 
 <<<
 <p>&lt; &amp;</p>
->>> greater than is not escaped
+>>> greater than is escaped
 not you >
 
 <<<
-<p>not you ></p>
+<p>not you &gt;</p>
 >>> existing entities are untouched
 &amp;
 
diff --git a/test/original/inline_code.unit b/test/original/inline_code.unit
index 05c31f9..53b0165 100644
--- a/test/original/inline_code.unit
+++ b/test/original/inline_code.unit
@@ -23,8 +23,7 @@
 second` after
 
 <<<
-<p>before <code>first
-second</code> after</p>
+<p>before <code>first second</code> after</p>
 >>> simple double backticks
 before ``source`` after
 
@@ -50,15 +49,13 @@
 another` after
 
 <<<
-<p>before <code>in tick
-another</code> after</p>
+<p>before <code>in tick another</code> after</p>
 >>> multiline double backticks with spaces
 before ``in `tick`
 another`` after
 
 <<<
-<p>before <code>in `tick`
-another</code> after</p>
+<p>before <code>in `tick` another</code> after</p>
 >>> ignore markup inside code
 before `*b* _c_` after
 
diff --git a/test/original/ordered_lists.unit b/test/original/ordered_lists.unit
index 060b701..8156889 100644
--- a/test/original/ordered_lists.unit
+++ b/test/original/ordered_lists.unit
@@ -3,14 +3,22 @@
 2.  two
 10. ten
 <<<
-<ol><li> one</li><li> two</li><li>ten</li></ol>
+<ol>
+<li>one</li>
+<li>two</li>
+<li>ten</li>
+</ol>
 >>> ordered list with almost nested item
 1.  one
 45.  two
    12345. three
 
 <<<
-<ol><li> one</li><li> two</li><li>three</li></ol>
+<ol>
+<li>one</li>
+<li>two</li>
+<li>three</li>
+</ol>
 >>> nested ordered lists
 1. one
 2. two
@@ -18,10 +26,24 @@
    4. four
 5. five
 <<<
-<ol><li>one</li><li>two<ol start="3"><li>three</li><li>four</li></ol></li><li>five</li></ol>
+<ol>
+<li>one</li>
+<li>two
+<ol start="3">
+<li>three</li>
+<li>four</li>
+</ol>
+</li>
+<li>five</li>
+</ol>
 >>> new list markers start new lists
 1. a
 * b
 
 <<<
-<ol><li>a</li></ol><ul><li>b</li></ul>
+<ol>
+<li>a</li>
+</ol>
+<ul>
+<li>b</li>
+</ul>
diff --git a/test/original/paragraphs.unit b/test/original/paragraphs.unit
index cd9181d..a20a556 100644
--- a/test/original/paragraphs.unit
+++ b/test/original/paragraphs.unit
@@ -24,13 +24,19 @@
 * list
 
 <<<
-<p>para</p><ul><li>list</li></ul>
+<p>para</p>
+<ul>
+<li>list</li>
+</ul>
 >>> are terminated by an ordered list
 para
 1. list
 
 <<<
-<p>para</p><ol><li>list</li></ol>
+<p>para</p>
+<ol>
+<li>list</li>
+</ol>
 >>> take account of windows line endings
 line1
 
@@ -46,4 +52,4 @@
 
 <<<
 <p>para
-    not code</p>
+not code</p>
diff --git a/test/original/reference_links.unit b/test/original/reference_links.unit
index 6c217a5..fe95fad 100644
--- a/test/original/reference_links.unit
+++ b/test/original/reference_links.unit
@@ -81,7 +81,8 @@
 > [are]: http://foo.com
 <<<
 <blockquote>
-<p>links <a href="http://foo.com">are</a> awesome</p></blockquote>
+<p>links <a href="http://foo.com">are</a> awesome</p>
+</blockquote>
 >>> reference link regression for github.com/dart-lang/markdown/issues/176
 [![Coverage Status][coverage_status]][coverage_page]
 
diff --git a/test/original/setext_headers.unit b/test/original/setext_headers.unit
index 7760d45..f094801 100644
--- a/test/original/setext_headers.unit
+++ b/test/original/setext_headers.unit
@@ -19,7 +19,9 @@
 -
 
 <<<
-<ul><li></li></ul>
+<ul>
+<li></li>
+</ul>
 >>> can be multiline
 header
 on two lines
diff --git a/test/original/unordered_lists.unit b/test/original/unordered_lists.unit
index 8c30026..6017775 100644
--- a/test/original/unordered_lists.unit
+++ b/test/original/unordered_lists.unit
@@ -4,28 +4,51 @@
 + plus
 
 <<<
-<ul><li>star</li></ul><ul><li>dash</li></ul><ul><li>plus</li></ul>
+<ul>
+<li>star</li>
+</ul>
+<ul>
+<li>dash</li>
+</ul>
+<ul>
+<li>plus</li>
+</ul>
 >>> new markers begin new lists
 * a
 1. b
 
 <<<
-<ul><li>a</li></ul><ol><li>b</li></ol>
+<ul>
+<li>a</li>
+</ul>
+<ol>
+<li>b</li>
+</ol>
 >>> allow a tab after the marker
 *	a
 1.	b
 
 <<<
-<ul><li>a</li></ul><ol><li>b</li></ol>
+<ul>
+<li>a</li>
+</ul>
+<ol>
+<li>b</li>
+</ol>
 >>> wrap items in paragraphs if blank lines separate
 * one
 
 * two
 
 <<<
-<ul><li>
-<p>one</p></li><li>
-<p>two</p></li></ul>
+<ul>
+<li>
+<p>one</p>
+</li>
+<li>
+<p>two</p>
+</li>
+</ul>
 >>> force paragraph on item before and after blank lines
 * one
 * two
@@ -33,20 +56,33 @@
 * three
 
 <<<
-<ul><li>
-<p>one</p></li><li>
-<p>two</p></li><li>
-<p>three</p></li></ul>
+<ul>
+<li>
+<p>one</p>
+</li>
+<li>
+<p>two</p>
+</li>
+<li>
+<p>three</p>
+</li>
+</ul>
 >>> do not force paragraph if item is already block
 * > quote
 
 * # header
 
 <<<
-<ul><li>
+<ul>
+<li>
 <blockquote>
-<p>quote</p></blockquote></li><li>
-<h1>header</h1></li></ul>
+<p>quote</p>
+</blockquote>
+</li>
+<li>
+<h1>header</h1>
+</li>
+</ul>
 >>> can contain multiple paragraphs
 * one
 
@@ -55,18 +91,26 @@
 * three
 
 <<<
-<ul><li>
+<ul>
+<li>
 <p>one</p>
-<p>two</p></li><li>
-<p>three</p></li></ul>
+<p>two</p>
+</li>
+<li>
+<p>three</p>
+</li>
+</ul>
 >>> can span newlines
 * one
   two
 * three
 
 <<<
-<ul><li>one
-two</li><li>three</li></ul>
+<ul>
+<li>one
+two</li>
+<li>three</li>
+</ul>
 >>> can nest lists
 * one
   * nested one
@@ -75,20 +119,33 @@
 * two
 
 <<<
-<ul><li>
-<p>one</p><ul><li>nested one</li><li>nested two</li></ul></li><li>
-<p>two</p></li></ul>
+<ul>
+<li>
+<p>one</p>
+<ul>
+<li>nested one</li>
+<li>nested two</li>
+</ul>
+</li>
+<li>
+<p>two</p>
+</li>
+</ul>
 >>> list item allows lazy continuations
 - list
 item
 
 <<<
-<ul><li>list
-item</li></ul>
+<ul>
+<li>list
+item</li>
+</ul>
 >>> list item turns what might be an h2 into nothing
 - list
 ---
 
 <<<
-<ul><li>list</li></ul>
+<ul>
+<li>list</li>
+</ul>
 <hr />
diff --git a/tool/common_mark_stats.json b/tool/common_mark_stats.json
index 89b34f9..5318f46 100644
--- a/tool/common_mark_stats.json
+++ b/tool/common_mark_stats.json
@@ -8,7 +8,7 @@
   "37": "strict",
   "38": "strict",
   "39": "strict",
-  "40": "loose",
+  "40": "strict",
   "41": "strict",
   "42": "strict",
   "43": "loose",
@@ -28,15 +28,15 @@
   "595": "strict",
   "596": "strict",
   "597": "strict",
-  "598": "loose",
+  "598": "strict",
   "599": "strict",
   "600": "strict",
   "601": "strict",
-  "602": "loose",
-  "603": "loose",
-  "604": "loose",
-  "605": "loose",
-  "606": "loose",
+  "602": "strict",
+  "603": "strict",
+  "604": "strict",
+  "605": "strict",
+  "606": "strict",
   "607": "strict",
   "608": "strict"
  },
@@ -59,31 +59,31 @@
   "197": "strict"
  },
  "Block quotes": {
-  "198": "loose",
-  "199": "loose",
-  "200": "loose",
+  "198": "strict",
+  "199": "strict",
+  "200": "strict",
   "201": "strict",
-  "202": "loose",
-  "203": "loose",
-  "204": "loose",
-  "205": "loose",
-  "206": "loose",
+  "202": "strict",
+  "203": "strict",
+  "204": "strict",
+  "205": "strict",
+  "206": "strict",
   "207": "fail",
   "208": "fail",
-  "209": "loose",
-  "210": "loose",
-  "211": "loose",
-  "212": "loose",
-  "213": "loose",
-  "214": "loose",
-  "215": "loose",
-  "216": "loose",
-  "217": "loose",
-  "218": "loose",
+  "209": "strict",
+  "210": "strict",
+  "211": "strict",
+  "212": "strict",
+  "213": "strict",
+  "214": "strict",
+  "215": "strict",
+  "216": "strict",
+  "217": "strict",
+  "218": "strict",
   "219": "fail",
-  "220": "loose",
-  "221": "loose",
-  "222": "loose"
+  "220": "strict",
+  "221": "strict",
+  "222": "strict"
  },
  "Code spans": {
   "328": "strict",
@@ -93,9 +93,9 @@
   "332": "loose",
   "333": "loose",
   "334": "loose",
-  "335": "loose",
+  "335": "strict",
   "336": "loose",
-  "337": "loose",
+  "337": "strict",
   "338": "strict",
   "339": "strict",
   "340": "strict",
@@ -103,7 +103,7 @@
   "342": "strict",
   "343": "loose",
   "344": "strict",
-  "345": "loose",
+  "345": "strict",
   "346": "strict",
   "347": "fail",
   "348": "strict",
@@ -271,7 +271,7 @@
   "95": "strict",
   "96": "loose",
   "97": "loose",
-  "98": "loose",
+  "98": "strict",
   "99": "strict",
   "100": "strict",
   "101": "loose",
@@ -300,8 +300,8 @@
   "634": "loose",
   "635": "strict",
   "636": "strict",
-  "637": "loose",
-  "638": "loose",
+  "637": "strict",
+  "638": "strict",
   "639": "strict",
   "640": "strict",
   "641": "strict",
@@ -380,12 +380,12 @@
  },
  "Indented code blocks": {
   "77": "strict",
-  "78": "loose",
-  "79": "loose",
+  "78": "strict",
+  "79": "strict",
   "80": "strict",
   "81": "fail",
   "82": "strict",
-  "83": "loose",
+  "83": "strict",
   "84": "strict",
   "85": "strict",
   "86": "strict",
@@ -418,11 +418,11 @@
   "180": "loose",
   "181": "strict",
   "182": "strict",
-  "183": "loose",
+  "183": "strict",
   "184": "fail",
   "185": "fail",
   "186": "strict",
-  "187": "loose",
+  "187": "strict",
   "188": "loose"
  },
  "Links": {
@@ -436,7 +436,7 @@
   "488": "strict",
   "489": "strict",
   "490": "loose",
-  "491": "loose",
+  "491": "strict",
   "492": "strict",
   "493": "strict",
   "494": "strict",
@@ -515,95 +515,95 @@
   "567": "strict"
  },
  "List items": {
-  "223": "loose",
-  "224": "loose",
-  "225": "loose",
-  "226": "loose",
-  "227": "loose",
-  "228": "loose",
-  "229": "loose",
-  "230": "loose",
+  "223": "strict",
+  "224": "strict",
+  "225": "strict",
+  "226": "strict",
+  "227": "strict",
+  "228": "strict",
+  "229": "strict",
+  "230": "strict",
   "231": "strict",
   "232": "fail",
-  "233": "loose",
+  "233": "strict",
   "234": "fail",
-  "235": "loose",
+  "235": "strict",
   "236": "strict",
-  "237": "loose",
-  "238": "loose",
+  "237": "strict",
+  "238": "strict",
   "239": "strict",
-  "240": "loose",
-  "241": "loose",
+  "240": "strict",
+  "241": "strict",
   "242": "strict",
-  "243": "loose",
-  "244": "loose",
-  "245": "loose",
-  "246": "loose",
-  "247": "loose",
-  "248": "loose",
-  "249": "loose",
+  "243": "strict",
+  "244": "strict",
+  "245": "strict",
+  "246": "strict",
+  "247": "strict",
+  "248": "strict",
+  "249": "strict",
   "250": "fail",
-  "251": "loose",
-  "252": "loose",
-  "253": "loose",
-  "254": "loose",
+  "251": "strict",
+  "252": "strict",
+  "253": "strict",
+  "254": "strict",
   "255": "fail",
-  "256": "loose",
-  "257": "loose",
-  "258": "loose",
+  "256": "strict",
+  "257": "strict",
+  "258": "strict",
   "259": "strict",
-  "260": "loose",
-  "261": "loose",
-  "262": "loose",
-  "263": "loose",
-  "264": "loose",
-  "265": "loose",
-  "266": "loose",
-  "267": "loose",
-  "268": "loose",
-  "269": "loose",
+  "260": "strict",
+  "261": "strict",
+  "262": "strict",
+  "263": "strict",
+  "264": "strict",
+  "265": "strict",
+  "266": "strict",
+  "267": "strict",
+  "268": "strict",
+  "269": "strict",
   "270": "loose"
  },
  "Lists": {
-  "271": "loose",
-  "272": "loose",
-  "273": "loose",
+  "271": "strict",
+  "272": "strict",
+  "273": "strict",
   "274": "fail",
-  "275": "loose",
+  "275": "strict",
   "276": "fail",
   "277": "fail",
   "278": "loose",
   "279": "loose",
-  "280": "loose",
-  "281": "loose",
-  "282": "loose",
-  "283": "loose",
-  "284": "loose",
-  "285": "loose",
-  "286": "loose",
+  "280": "strict",
+  "281": "strict",
+  "282": "strict",
+  "283": "strict",
+  "284": "strict",
+  "285": "strict",
+  "286": "strict",
   "287": "loose",
   "288": "fail",
-  "289": "loose",
-  "290": "loose",
-  "291": "loose",
-  "292": "loose",
-  "293": "loose",
-  "294": "loose",
-  "295": "loose",
-  "296": "loose"
+  "289": "strict",
+  "290": "strict",
+  "291": "strict",
+  "292": "strict",
+  "293": "strict",
+  "294": "strict",
+  "295": "strict",
+  "296": "strict"
  },
  "Paragraphs": {
   "189": "strict",
   "190": "strict",
   "191": "strict",
-  "192": "loose",
-  "193": "loose",
-  "194": "loose",
+  "192": "strict",
+  "193": "strict",
+  "194": "strict",
   "195": "strict",
   "196": "loose"
  },
  "Precedence": {
-  "12": "loose"
+  "12": "strict"
  },
  "Raw HTML": {
   "609": "strict",
@@ -611,7 +611,7 @@
   "611": "strict",
   "612": "strict",
   "613": "strict",
-  "614": "loose",
+  "614": "strict",
   "615": "fail",
   "616": "loose",
   "617": "fail",
@@ -619,8 +619,8 @@
   "619": "strict",
   "620": "fail",
   "621": "loose",
-  "622": "loose",
-  "623": "loose",
+  "622": "strict",
+  "623": "strict",
   "624": "strict",
   "625": "strict",
   "626": "loose",
@@ -636,21 +636,21 @@
   "54": "loose",
   "55": "strict",
   "56": "strict",
-  "57": "loose",
+  "57": "strict",
   "58": "strict",
   "59": "loose",
   "60": "strict",
   "61": "loose",
-  "62": "loose",
+  "62": "strict",
   "63": "fail",
-  "64": "loose",
+  "64": "strict",
   "65": "strict",
   "66": "strict",
   "67": "strict",
   "68": "strict",
-  "69": "loose",
+  "69": "strict",
   "70": "strict",
-  "71": "loose",
+  "71": "strict",
   "72": "loose",
   "73": "strict",
   "74": "strict",
@@ -665,12 +665,12 @@
   "1": "strict",
   "2": "strict",
   "3": "strict",
-  "4": "loose",
-  "5": "loose",
+  "4": "strict",
+  "5": "strict",
   "6": "loose",
   "7": "loose",
   "8": "strict",
-  "9": "loose",
+  "9": "strict",
   "10": "strict",
   "11": "strict"
  },
@@ -686,18 +686,18 @@
   "16": "strict",
   "17": "strict",
   "18": "strict",
-  "19": "loose",
+  "19": "strict",
   "20": "strict",
   "21": "strict",
   "22": "strict",
   "23": "strict",
   "24": "strict",
   "25": "strict",
-  "26": "loose",
-  "27": "loose",
+  "26": "strict",
+  "27": "strict",
   "28": "strict",
   "29": "strict",
-  "30": "loose",
-  "31": "loose"
+  "30": "strict",
+  "31": "strict"
  }
 }
diff --git a/tool/common_mark_stats.txt b/tool/common_mark_stats.txt
index 8f3eee0..86ccf5d 100644
--- a/tool/common_mark_stats.txt
+++ b/tool/common_mark_stats.txt
@@ -25,4 +25,4 @@
    3 of    3 – 100.0%  Textual content
   19 of   19 – 100.0%  Thematic breaks
  597 of  649 –  92.0%  TOTAL
- 406 of  597 –  68.0%  TOTAL Strict
+ 523 of  597 –  87.6%  TOTAL Strict
diff --git a/tool/gfm_stats.json b/tool/gfm_stats.json
index d8f8cf6..a1ac55f 100644
--- a/tool/gfm_stats.json
+++ b/tool/gfm_stats.json
@@ -8,7 +8,7 @@
   "37": "strict",
   "38": "strict",
   "39": "strict",
-  "40": "loose",
+  "40": "strict",
   "41": "strict",
   "42": "strict",
   "43": "loose",
@@ -28,15 +28,15 @@
   "607": "strict",
   "608": "strict",
   "609": "strict",
-  "610": "loose",
+  "610": "strict",
   "611": "strict",
   "612": "strict",
   "613": "strict",
-  "614": "loose",
-  "615": "loose",
+  "614": "strict",
+  "615": "strict",
   "616": "fail",
-  "617": "loose",
-  "618": "loose",
+  "617": "strict",
+  "618": "strict",
   "619": "fail",
   "620": "strict"
  },
@@ -72,31 +72,31 @@
   "197": "strict"
  },
  "Block quotes": {
-  "206": "loose",
-  "207": "loose",
-  "208": "loose",
+  "206": "strict",
+  "207": "strict",
+  "208": "strict",
   "209": "strict",
-  "210": "loose",
-  "211": "loose",
-  "212": "loose",
-  "213": "loose",
-  "214": "loose",
+  "210": "strict",
+  "211": "strict",
+  "212": "strict",
+  "213": "strict",
+  "214": "strict",
   "215": "fail",
   "216": "fail",
-  "217": "loose",
-  "218": "loose",
-  "219": "loose",
-  "220": "loose",
-  "221": "loose",
-  "222": "loose",
-  "223": "loose",
-  "224": "loose",
-  "225": "loose",
-  "226": "loose",
+  "217": "strict",
+  "218": "strict",
+  "219": "strict",
+  "220": "strict",
+  "221": "strict",
+  "222": "strict",
+  "223": "strict",
+  "224": "strict",
+  "225": "strict",
+  "226": "strict",
   "227": "fail",
-  "228": "loose",
-  "229": "loose",
-  "230": "loose"
+  "228": "strict",
+  "229": "strict",
+  "230": "strict"
  },
  "Code spans": {
   "338": "strict",
@@ -106,9 +106,9 @@
   "342": "loose",
   "343": "loose",
   "344": "loose",
-  "345": "loose",
+  "345": "strict",
   "346": "loose",
-  "347": "loose",
+  "347": "strict",
   "348": "strict",
   "349": "strict",
   "350": "strict",
@@ -116,7 +116,7 @@
   "352": "strict",
   "353": "loose",
   "354": "strict",
-  "355": "loose",
+  "355": "strict",
   "356": "strict",
   "357": "fail",
   "358": "strict",
@@ -287,7 +287,7 @@
   "95": "strict",
   "96": "loose",
   "97": "loose",
-  "98": "loose",
+  "98": "strict",
   "99": "strict",
   "100": "strict",
   "101": "loose",
@@ -316,8 +316,8 @@
   "658": "loose",
   "659": "strict",
   "660": "strict",
-  "661": "loose",
-  "662": "loose",
+  "661": "strict",
+  "662": "strict",
   "663": "strict",
   "664": "strict",
   "665": "strict",
@@ -396,12 +396,12 @@
  },
  "Indented code blocks": {
   "77": "strict",
-  "78": "loose",
-  "79": "loose",
+  "78": "strict",
+  "79": "strict",
   "80": "strict",
   "81": "fail",
   "82": "strict",
-  "83": "loose",
+  "83": "strict",
   "84": "strict",
   "85": "strict",
   "86": "strict",
@@ -434,11 +434,11 @@
   "180": "loose",
   "181": "strict",
   "182": "strict",
-  "183": "loose",
+  "183": "strict",
   "184": "fail",
   "185": "fail",
   "186": "strict",
-  "187": "loose",
+  "187": "strict",
   "188": "loose"
  },
  "Links": {
@@ -452,7 +452,7 @@
   "500": "strict",
   "501": "strict",
   "502": "loose",
-  "503": "loose",
+  "503": "strict",
   "504": "strict",
   "505": "strict",
   "506": "strict",
@@ -531,95 +531,95 @@
   "579": "strict"
  },
  "List items": {
-  "231": "loose",
-  "232": "loose",
-  "233": "loose",
-  "234": "loose",
-  "235": "loose",
-  "236": "loose",
-  "237": "loose",
-  "238": "loose",
+  "231": "strict",
+  "232": "strict",
+  "233": "strict",
+  "234": "strict",
+  "235": "strict",
+  "236": "strict",
+  "237": "strict",
+  "238": "strict",
   "239": "strict",
   "240": "fail",
-  "241": "loose",
+  "241": "strict",
   "242": "fail",
-  "243": "loose",
+  "243": "strict",
   "244": "strict",
-  "245": "loose",
-  "246": "loose",
+  "245": "strict",
+  "246": "strict",
   "247": "strict",
-  "248": "loose",
-  "249": "loose",
+  "248": "strict",
+  "249": "strict",
   "250": "strict",
-  "251": "loose",
-  "252": "loose",
-  "253": "loose",
-  "254": "loose",
-  "255": "loose",
-  "256": "loose",
-  "257": "loose",
+  "251": "strict",
+  "252": "strict",
+  "253": "strict",
+  "254": "strict",
+  "255": "strict",
+  "256": "strict",
+  "257": "strict",
   "258": "fail",
-  "259": "loose",
-  "260": "loose",
-  "261": "loose",
-  "262": "loose",
+  "259": "strict",
+  "260": "strict",
+  "261": "strict",
+  "262": "strict",
   "263": "fail",
-  "264": "loose",
-  "265": "loose",
-  "266": "loose",
+  "264": "strict",
+  "265": "strict",
+  "266": "strict",
   "267": "strict",
-  "268": "loose",
-  "269": "loose",
-  "270": "loose",
-  "271": "loose",
-  "272": "loose",
-  "273": "loose",
-  "274": "loose",
-  "275": "loose",
-  "276": "loose",
-  "277": "loose",
+  "268": "strict",
+  "269": "strict",
+  "270": "strict",
+  "271": "strict",
+  "272": "strict",
+  "273": "strict",
+  "274": "strict",
+  "275": "strict",
+  "276": "strict",
+  "277": "strict",
   "278": "loose"
  },
  "Lists": {
-  "281": "loose",
-  "282": "loose",
-  "283": "loose",
+  "281": "strict",
+  "282": "strict",
+  "283": "strict",
   "284": "fail",
-  "285": "loose",
+  "285": "strict",
   "286": "fail",
   "287": "fail",
   "288": "loose",
   "289": "loose",
-  "290": "loose",
-  "291": "loose",
-  "292": "loose",
-  "293": "loose",
-  "294": "loose",
-  "295": "loose",
-  "296": "loose",
+  "290": "strict",
+  "291": "strict",
+  "292": "strict",
+  "293": "strict",
+  "294": "strict",
+  "295": "strict",
+  "296": "strict",
   "297": "loose",
   "298": "fail",
-  "299": "loose",
-  "300": "loose",
-  "301": "loose",
-  "302": "loose",
-  "303": "loose",
-  "304": "loose",
-  "305": "loose",
-  "306": "loose"
+  "299": "strict",
+  "300": "strict",
+  "301": "strict",
+  "302": "strict",
+  "303": "strict",
+  "304": "strict",
+  "305": "strict",
+  "306": "strict"
  },
  "Paragraphs": {
   "189": "strict",
   "190": "strict",
   "191": "strict",
-  "192": "loose",
-  "193": "loose",
-  "194": "loose",
+  "192": "strict",
+  "193": "strict",
+  "194": "strict",
   "195": "strict",
   "196": "loose"
  },
  "Precedence": {
-  "12": "loose"
+  "12": "strict"
  },
  "Raw HTML": {
   "632": "strict",
@@ -627,7 +627,7 @@
   "634": "strict",
   "635": "strict",
   "636": "strict",
-  "637": "loose",
+  "637": "strict",
   "638": "fail",
   "639": "loose",
   "640": "fail",
@@ -635,8 +635,8 @@
   "642": "strict",
   "643": "fail",
   "644": "loose",
-  "645": "loose",
-  "646": "loose",
+  "645": "strict",
+  "646": "strict",
   "647": "strict",
   "648": "strict",
   "649": "loose",
@@ -652,21 +652,21 @@
   "54": "loose",
   "55": "strict",
   "56": "strict",
-  "57": "loose",
+  "57": "strict",
   "58": "strict",
   "59": "loose",
   "60": "strict",
   "61": "loose",
-  "62": "loose",
+  "62": "strict",
   "63": "fail",
-  "64": "loose",
+  "64": "strict",
   "65": "strict",
   "66": "strict",
   "67": "strict",
   "68": "strict",
-  "69": "loose",
+  "69": "strict",
   "70": "strict",
-  "71": "loose",
+  "71": "strict",
   "72": "loose",
   "73": "strict",
   "74": "strict",
@@ -695,12 +695,12 @@
   "1": "strict",
   "2": "strict",
   "3": "strict",
-  "4": "loose",
-  "5": "loose",
+  "4": "strict",
+  "5": "strict",
   "6": "loose",
   "7": "loose",
   "8": "strict",
-  "9": "loose",
+  "9": "strict",
   "10": "strict",
   "11": "strict"
  },
@@ -716,18 +716,18 @@
   "16": "strict",
   "17": "strict",
   "18": "strict",
-  "19": "loose",
+  "19": "strict",
   "20": "strict",
   "21": "strict",
   "22": "strict",
   "23": "strict",
   "24": "strict",
   "25": "strict",
-  "26": "loose",
-  "27": "loose",
+  "26": "strict",
+  "27": "strict",
   "28": "strict",
   "29": "strict",
-  "30": "loose",
-  "31": "loose"
+  "30": "strict",
+  "31": "strict"
  }
 }
diff --git a/tool/gfm_stats.txt b/tool/gfm_stats.txt
index 38a0d70..3c7f6ba 100644
--- a/tool/gfm_stats.txt
+++ b/tool/gfm_stats.txt
@@ -29,4 +29,4 @@
    3 of    3 – 100.0%  Textual content
   19 of   19 – 100.0%  Thematic breaks
  612 of  671 –  91.2%  TOTAL
- 413 of  612 –  67.5%  TOTAL Strict
+ 529 of  612 –  86.4%  TOTAL Strict