packages feed

markdown 0.1.6.1 → 0.1.7

raw patch · 4 files changed

+28/−15 lines, 4 files

Files

Text/Markdown.hs view
@@ -12,6 +12,7 @@     , msBlockCodeRenderer     , msLinkNewTab     , msBlankBeforeBlockquote+    , msBlockFilter       -- * Newtype     , Markdown (..)       -- * Fenced handlers@@ -69,17 +70,19 @@     sanitize         | msXssProtect ms = preEscapedToMarkup . sanitizeBalance . TL.toStrict . renderHtml         | otherwise = id-    fixBlock :: Block Text -> Block Html-    fixBlock = fmap $ toHtmlI ms . toInline refs-     blocksH :: [Block Html]-    blocksH = map fixBlock blocks+    blocksH = processBlocks blocks      blocks :: [Block Text]     blocks = runIdentity            $ CL.sourceList (TL.toChunks tl)           $$ toBlocks ms           =$ CL.consume++    processBlocks :: [Block Text] -> [Block Html]+    processBlocks = map (fmap $ toHtmlI ms)+                  . msBlockFilter ms+                  . map (fmap $ toInline refs)      refs =         Map.unions $ map toRef blocks
Text/Markdown/Inline.hs view
@@ -13,6 +13,7 @@ import Control.Applicative import Data.Monoid (Monoid, mappend) import qualified Data.Map as Map+import Text.Markdown.Types (Inline(..))  type RefMap = Map.Map Text Text @@ -25,16 +26,6 @@ (<>) :: Monoid m => m -> m -> m (<>) = mappend -data Inline = InlineText Text-            | InlineItalic [Inline]-            | InlineBold [Inline]-            | InlineCode Text-            | InlineHtml Text-            | InlineLink Text (Maybe Text) [Inline] -- ^ URL, title, content-            | InlineImage Text (Maybe Text) Text -- ^ URL, title, content-            | InlineFootnoteRef Integer -- ^ The footnote reference in the body-            | InlineFootnote Integer-    deriving (Show, Eq)  inlineParser :: RefMap -> Parser [Inline] inlineParser = fmap combine . many . inlineAny
Text/Markdown/Types.hs view
@@ -81,6 +81,13 @@       -- Default: @True@       --       -- Since 0.1.5+    , msBlockFilter :: [Block [Inline]] -> [Block [Inline]]+      -- ^ A function to filter and/or modify parsed blocks before they are+      -- written to Html+      --+      -- Default: @id@+      --+      -- Since 0.1.7     }  -- | See 'msFencedHandlers.@@ -102,6 +109,7 @@                                        Nothing -> H.pre $ H.code $ rendered         , msLinkNewTab = False         , msBlankBeforeBlockquote = True+        , msBlockFilter = id         }  -- | Helper for creating a 'FHRaw'.@@ -157,3 +165,14 @@     fmap f (BlockHeading level i) = BlockHeading level (f i)     fmap _ (BlockReference x y) = BlockReference x y     fmap f (BlockPlainText x) = BlockPlainText (f x)++data Inline = InlineText Text+            | InlineItalic [Inline]+            | InlineBold [Inline]+            | InlineCode Text+            | InlineHtml Text+            | InlineLink Text (Maybe Text) [Inline] -- ^ URL, title, content+            | InlineImage Text (Maybe Text) Text -- ^ URL, title, content+            | InlineFootnoteRef Integer -- ^ The footnote reference in the body+            | InlineFootnote Integer+    deriving (Show, Eq)
markdown.cabal view
@@ -1,5 +1,5 @@ Name:                markdown-Version:             0.1.6.1+Version:             0.1.7 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