diff --git a/doctemplates.cabal b/doctemplates.cabal
--- a/doctemplates.cabal
+++ b/doctemplates.cabal
@@ -1,5 +1,5 @@
 name:                doctemplates
-version:             0.2
+version:             0.2.1
 synopsis:            Pandoc-style document templates
 description:         A simple text templating system used by pandoc.
 homepage:            https://github.com/jgm/doctemplates#readme
diff --git a/src/Text/DocTemplates.hs b/src/Text/DocTemplates.hs
--- a/src/Text/DocTemplates.hs
+++ b/src/Text/DocTemplates.hs
@@ -245,8 +245,14 @@
 pEscapedDollar = lit "$" <$ P.try (P.string "$$")
 
 pComment :: Parser Template
-pComment =
-  mempty <$ (P.try (P.string "$--") >> P.skipMany (P.satisfy (/='\n')))
+pComment = do
+  pos <- P.getPosition
+  P.try (P.string "$--")
+  P.skipMany (P.satisfy (/='\n'))
+  -- If the comment begins in the first column, the line ending
+  -- will be consumed; otherwise not.
+  when (P.sourceColumn pos == 1) $ () <$ P.char '\n'
+  return mempty
 
 pVar :: Parser Template
 pVar = var <$> (P.try $ P.char '$' *> pIdent <* P.char '$')
diff --git a/test/Spec.hs b/test/Spec.hs
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -35,7 +35,7 @@
         `shouldBe`
         (Right "5 and 7.3" :: Either String Text)
     it "handles comments" $ do
-      applyTemplate "hello $--there and $m$\nbar"
+      applyTemplate "hello $--there and $m$\n$-- comment\nbar"
         (object ["m" .= (5 :: Integer)])
         `shouldBe`
         (Right "hello \nbar" :: Either String Text)
