packages feed

markdown 0.1.4 → 0.1.5

raw patch · 5 files changed

+24/−3 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Text.Markdown: msBlankBeforeBlockquote :: MarkdownSettings -> Bool

Files

Text/Markdown.hs view
@@ -11,6 +11,7 @@     , msFencedHandlers     , msBlockCodeRenderer     , msLinkNewTab+    , msBlankBeforeBlockquote       -- * Newtype     , Markdown (..)       -- * Fenced handlers
Text/Markdown/Block.hs view
@@ -229,6 +229,7 @@                             Nothing -> False                     isNonPara LineBlank = True                     isNonPara LineFenced{} = True+                    isNonPara LineBlockQuote{} = not $ msBlankBeforeBlockquote ms                     isNonPara _ = False                 (mfinal, ls) <- takeTillConsume (\x -> isNonPara (lineType ms x) || listStartIndent x)                 maybe (return ()) leftover mfinal
Text/Markdown/Types.hs view
@@ -72,6 +72,15 @@       -- Default: @False@       --       -- Since 0.1.4++    , msBlankBeforeBlockquote :: Bool+      -- ^ If @True@, a blank line is required before the start of a blockquote.  Standard+      -- markdown syntax does not require a blank line before a blockquote, but it is all+      -- too easy for a > to end up at the beginning of a line by accident.+      --+      -- Default: @True@+      --+      -- Since 0.1.5     }  -- | See 'msFencedHandlers.@@ -92,6 +101,7 @@                                        Just l -> H.pre $ H.code H.! HA.class_ (H.toValue l) $ rendered                                        Nothing -> H.pre $ H.code $ rendered         , msLinkNewTab = False+        , msBlankBeforeBlockquote = True         }  -- | Helper for creating a 'FHRaw'.
markdown.cabal view
@@ -1,5 +1,5 @@ Name:                markdown-Version:             0.1.4+Version:             0.1.5 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/Block.hs view
@@ -6,12 +6,15 @@ import Data.Text (Text) import Data.Conduit import qualified Data.Conduit.List as CL-import Text.Markdown (def)+import Text.Markdown (def, MarkdownSettings(..)) import Text.Markdown.Block import Data.Functor.Identity (runIdentity) +checkWith :: MarkdownSettings -> Text -> [Block Text] -> Expectation+checkWith ms md blocks = runIdentity (yield md $$ toBlocks ms =$ CL.consume) `shouldBe` blocks+ check :: Text -> [Block Text] -> Expectation-check md blocks = runIdentity (yield md $$ toBlocks def =$ CL.consume) `shouldBe` blocks+check = checkWith def  blockSpecs :: Spec blockSpecs = do@@ -62,6 +65,12 @@             [ BlockQuote [BlockPara "foo"]             , BlockQuote [BlockList Unordered $ Left "bar"]             ]+        it "require blank before blockquote" $ check+            "foo\n> bar"+            [ BlockPara "foo\n> bar" ]+        it "no blank before blockquote" $ checkWith def { msBlankBeforeBlockquote = False }+            "foo\n> bar"+            [ BlockPara "foo", BlockQuote [BlockPara "bar"]]     describe "indented code" $ do         it "simple" $ check             "    foo\n    bar\n"