markdown 0.1.13.2 → 0.1.14
raw patch · 4 files changed
+16/−3 lines, 4 filesdep +xml-conduitdep +xml-types
Dependencies added: xml-conduit, xml-types
Files
- Text/Markdown/Inline.hs +11/−0
- markdown.cabal +3/−1
- test/examples/entities.html +1/−1
- test/examples/entities.md +1/−1
Text/Markdown/Inline.hs view
@@ -14,6 +14,8 @@ import Data.Monoid (Monoid, mappend) import qualified Data.Map as Map import Text.Markdown.Types (Inline(..))+import Data.XML.Types (Content (..))+import Text.XML.Stream.Parse (decodeHtmlEntities) type RefMap = Map.Map Text Text @@ -207,6 +209,7 @@ <|> rawent "'" <|> decEnt <|> hexEnt+ <|> namedEnt rawent t = InlineHtml <$> string t @@ -229,6 +232,14 @@ , t , T.singleton c ]++ namedEnt = do+ _s <- char '&'+ t <- takeWhile1 (/= ';')+ _c <- char ';'+ case decodeHtmlEntities t of+ ContentText t' -> return $ InlineHtml t'+ ContentEntity _ -> fail "Unknown named entity" hrefChar :: Parser Char hrefChar = (char '\\' *> anyChar) <|> satisfy (notInClass " )")
markdown.cabal view
@@ -1,5 +1,5 @@ Name: markdown-Version: 0.1.13.2+Version: 0.1.14 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@@ -31,6 +31,8 @@ , data-default >= 0.3 , xss-sanitize >= 0.3.3 , containers+ , xml-types+ , xml-conduit ghc-options: -Wall test-suite test
test/examples/entities.html view
@@ -1,1 +1,1 @@-<p>1 < 2 & 2 > 1, also 1 < 2 & 2 > 1 ý &#xP;</p>+<p>1 < 2 & 2 > 1, also 1 < 2 & 2 > 1 ý &#xP; …</p>
test/examples/entities.md view
@@ -1,1 +1,1 @@-1 < 2 & 2 > 1, also 1 < 2 & 2 > 1   ý &#xP;+1 < 2 & 2 > 1, also 1 < 2 & 2 > 1   ý &#xP; …