markdown 0.1.11 → 0.1.12
raw patch · 4 files changed
+21/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Text/Markdown.hs +4/−1
- Text/Markdown/Block.hs +6/−0
- markdown.cabal +1/−1
- test/main.hs +10/−0
Text/Markdown.hs view
@@ -29,6 +29,7 @@ import Text.Markdown.Types import Prelude hiding (sequence, takeWhile) import Data.Default (Default (..))+import Data.List (intercalate) import Data.Text (Text) import qualified Data.Text.Lazy as TL import Text.Blaze.Html (ToMarkup (..), Html)@@ -82,7 +83,9 @@ processBlocks :: [Block Text] -> [Block Html] processBlocks = map (fmap $ toHtmlI ms) . msBlockFilter ms- . map (fmap $ toInline refs)+ . map (fmap $ intercalate [InlineHtml "<br>"])+ . map (fmap $ map $ toInline refs)+ . map toBlockLines refs = Map.unions $ map toRef blocks
Text/Markdown/Block.hs view
@@ -8,6 +8,7 @@ ( Block (..) , ListType (..) , toBlocks+ , toBlockLines ) where import Prelude@@ -32,6 +33,11 @@ (=$=) :: Monad m => Pipe a a b x m y -> Pipe b b c y m z -> Pipe a a c x m z (=$=) = pipeL #endif++toBlockLines :: Block Text -> Block [Text]+toBlockLines = fmap $ map T.stripEnd+ . concatMap (T.splitOn " \r\n")+ . T.splitOn " \n" toBlocks :: Monad m => MarkdownSettings -> Conduit Text m (Block Text) toBlocks ms =
markdown.cabal view
@@ -1,5 +1,5 @@ Name: markdown-Version: 0.1.11+Version: 0.1.12 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
test/main.hs view
@@ -43,6 +43,16 @@ hspec $ do describe "block" blockSpecs describe "inline" inlineSpecs+ describe "line break" $ do+ it "is inserted for a single newline after two spaces"+ $ check "<p>Hello<br>World!</p>" "Hello \nWorld!"+ it "is also inserted for a single CRLF after two spaces"+ $ check "<p>Hello<br>World!</p>" "Hello \r\nWorld!"+ it "preserves quote nesting of the previous line"+ $ check "<blockquote><p>Q1<br>Q2</p></blockquote><p>P2</p>"+ "> Q1 \nQ2\n\nP2"+ it "consumes all trailing whitespace on the previous line"+ $ check "<p>Hello<br>World!</p>" "Hello \nWorld!" describe "paragraphs" $ do it "simple" $ check "<p>Hello World!</p>" "Hello World!"