diff --git a/Text/Markdown/Block.hs b/Text/Markdown/Block.hs
--- a/Text/Markdown/Block.hs
+++ b/Text/Markdown/Block.hs
@@ -231,22 +231,27 @@
                     isNonPara LineBlank = True
                     isNonPara LineFenced{} = True
                     isNonPara LineBlockQuote{} = not $ msBlankBeforeBlockquote ms
+                    isNonPara LineHtml{} = True -- See example 95 in Common Markdown spec
                     isNonPara _ = False
                 (mfinal, ls) <- takeTillConsume (\x -> isNonPara (lineType ms x) || listStartIndent x)
                 maybe (return ()) leftover mfinal
                 yield $ Right $ BlockPara $ T.intercalate "\n" $ t' : ls
 
 isHtmlStart :: T.Text -> Bool
+-- Allow for up to three spaces before the opening tag.
+isHtmlStart t | "    " `T.isPrefixOf` t = False
 isHtmlStart t =
-    case T.stripPrefix "<" t of
+    case T.stripPrefix "<" $ T.dropWhile (== ' ') t of
         Nothing -> False
         Just t' ->
             let (name, rest)
                     | Just _ <- T.stripPrefix "!--" t' = ("--", t')
                     | otherwise = T.break (\c -> c `elem` " >") t'
-             in T.all isValidTagName name &&
+             in (T.all isValidTagName name &&
                 not (T.null name) &&
-                (not ("/" `T.isPrefixOf` rest) || ("/>" `T.isPrefixOf` rest))
+                (not ("/" `T.isPrefixOf` rest) || ("/>" `T.isPrefixOf` rest)))
+
+                || isPI t' || isCommentCData t'
   where
     isValidTagName :: Char -> Bool
     isValidTagName c =
@@ -257,6 +262,9 @@
         (c == '_') ||
         (c == '/') ||
         (c == '!')
+
+    isPI = ("?" `T.isPrefixOf`)
+    isCommentCData = ("!" `T.isPrefixOf`)
 
 takeTill :: Monad m => (i -> Bool) -> Conduit i m i
 takeTill f =
diff --git a/markdown.cabal b/markdown.cabal
--- a/markdown.cabal
+++ b/markdown.cabal
@@ -1,5 +1,5 @@
 Name:                markdown
-Version:             0.1.10
+Version:             0.1.11
 Synopsis:            Convert Markdown to HTML, with XSS protection
 Description:         This library leverages existing high-performance libraries (attoparsec, blaze-html, text, and conduit), and should integrate well with existing codebases.
 Homepage:            https://github.com/snoyberg/markdown
diff --git a/test/examples/html-blocks-spec1.html b/test/examples/html-blocks-spec1.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec1.html
@@ -0,0 +1,7 @@
+<table>
+  <tr>
+    <td>
+           hi
+    </td>
+  </tr>
+</table><p>okay.</p>
diff --git a/test/examples/html-blocks-spec1.md b/test/examples/html-blocks-spec1.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec1.md
@@ -0,0 +1,9 @@
+<table>
+  <tr>
+    <td>
+           hi
+    </td>
+  </tr>
+</table>
+
+okay.
diff --git a/test/examples/html-blocks-spec10.html b/test/examples/html-blocks-spec10.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec10.html
@@ -0,0 +1,4 @@
+<div>
+bar
+</div>
+*foo*
diff --git a/test/examples/html-blocks-spec10.md b/test/examples/html-blocks-spec10.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec10.md
@@ -0,0 +1,4 @@
+<div>
+bar
+</div>
+*foo*
diff --git a/test/examples/html-blocks-spec11.html b/test/examples/html-blocks-spec11.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec11.html
@@ -0,0 +1,2 @@
+<div class
+foo
diff --git a/test/examples/html-blocks-spec11.md b/test/examples/html-blocks-spec11.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec11.md
@@ -0,0 +1,2 @@
+<div class
+foo
diff --git a/test/examples/html-blocks-spec2.html b/test/examples/html-blocks-spec2.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec2.html
@@ -0,0 +1,3 @@
+ <div>
+  *hello*
+         <foo><a>
diff --git a/test/examples/html-blocks-spec2.md b/test/examples/html-blocks-spec2.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec2.md
@@ -0,0 +1,3 @@
+ <div>
+  *hello*
+         <foo><a>
diff --git a/test/examples/html-blocks-spec3.html b/test/examples/html-blocks-spec3.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec3.html
@@ -0,0 +1,1 @@
+<DIV CLASS="foo"><p><i>Markdown</i></p></DIV>
diff --git a/test/examples/html-blocks-spec3.md b/test/examples/html-blocks-spec3.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec3.md
@@ -0,0 +1,5 @@
+<DIV CLASS="foo">
+
+*Markdown*
+
+</DIV>
diff --git a/test/examples/html-blocks-spec4.html b/test/examples/html-blocks-spec4.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec4.html
@@ -0,0 +1,4 @@
+<div></div>
+``` c
+int x = 33;
+```
diff --git a/test/examples/html-blocks-spec4.md b/test/examples/html-blocks-spec4.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec4.md
@@ -0,0 +1,4 @@
+<div></div>
+``` c
+int x = 33;
+```
diff --git a/test/examples/html-blocks-spec5.html b/test/examples/html-blocks-spec5.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec5.html
@@ -0,0 +1,3 @@
+<!-- Foo
+bar
+   baz -->
diff --git a/test/examples/html-blocks-spec5.md b/test/examples/html-blocks-spec5.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec5.md
@@ -0,0 +1,3 @@
+<!-- Foo
+bar
+   baz -->
diff --git a/test/examples/html-blocks-spec6.html b/test/examples/html-blocks-spec6.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec6.html
@@ -0,0 +1,3 @@
+<?php
+  echo 'foo'
+  ?>
diff --git a/test/examples/html-blocks-spec6.md b/test/examples/html-blocks-spec6.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec6.md
@@ -0,0 +1,3 @@
+<?php
+  echo 'foo'
+  ?>
diff --git a/test/examples/html-blocks-spec7.html b/test/examples/html-blocks-spec7.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec7.html
@@ -0,0 +1,13 @@
+<![CDATA[
+function matchwo(a,b)
+{
+if (a < b && a < 0) then
+  {
+  return 1;
+  }
+else
+  {
+  return 0;
+  }
+}
+]]>
diff --git a/test/examples/html-blocks-spec7.md b/test/examples/html-blocks-spec7.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec7.md
@@ -0,0 +1,13 @@
+<![CDATA[
+function matchwo(a,b)
+{
+if (a < b && a < 0) then
+  {
+  return 1;
+  }
+else
+  {
+  return 0;
+  }
+}
+]]>
diff --git a/test/examples/html-blocks-spec8.html b/test/examples/html-blocks-spec8.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec8.html
@@ -0,0 +1,1 @@
+  <!-- foo --><pre><code>&lt;!-- foo --&gt;</code></pre>
diff --git a/test/examples/html-blocks-spec8.md b/test/examples/html-blocks-spec8.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec8.md
@@ -0,0 +1,3 @@
+  <!-- foo -->
+
+    <!-- foo -->
diff --git a/test/examples/html-blocks-spec9.html b/test/examples/html-blocks-spec9.html
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec9.html
@@ -0,0 +1,3 @@
+<p>Foo</p><div>
+bar
+</div>
diff --git a/test/examples/html-blocks-spec9.md b/test/examples/html-blocks-spec9.md
new file mode 100644
--- /dev/null
+++ b/test/examples/html-blocks-spec9.md
@@ -0,0 +1,4 @@
+Foo
+<div>
+bar
+</div>
diff --git a/test/main.hs b/test/main.hs
--- a/test/main.hs
+++ b/test/main.hs
@@ -10,6 +10,8 @@
 import Control.Monad (forM_)
 import qualified Data.Set as Set
 import qualified Data.Map as Map
+import Data.List (isInfixOf)
+import Data.Maybe (fromMaybe)
 
 import qualified Filesystem.Path.CurrentOS as F
 import qualified Filesystem as F
@@ -233,7 +235,13 @@
     go fp = do
         input <- F.readTextFile fp
         output <- F.readTextFile $ F.replaceExtension fp "html"
-        return $ it (F.encodeString $ F.basename fp) $ check (fromStrict $ T.strip output) (fromStrict input)
+        let (checker, stripper)
+                | "-spec" `isInfixOf` F.encodeString fp = (check', dropFinalLF)
+                | otherwise = (check, T.strip)
+
+        return $ it (F.encodeString $ F.basename fp) $ checker (fromStrict $ stripper output) (fromStrict input)
+
+    dropFinalLF t = fromMaybe t $ T.stripSuffix "\n" t
 
 getGruber :: IO [Spec]
 getGruber = do
