markdown 0.1.3 → 0.1.4
raw patch · 4 files changed
+19/−3 lines, 4 files
Files
- Text/Markdown.hs +7/−2
- Text/Markdown/Types.hs +8/−0
- markdown.cabal +1/−1
- test/main.hs +3/−0
Text/Markdown.hs view
@@ -10,6 +10,7 @@ , msStandaloneHtml , msFencedHandlers , msBlockCodeRenderer+ , msLinkNewTab -- * Newtype , Markdown (..) -- * Fenced handlers@@ -150,8 +151,12 @@ go (InlineItalic is) = H.i $ gos is go (InlineBold is) = H.b $ gos is go (InlineCode t) = H.code $ toMarkup t- go (InlineLink url Nothing content) = H.a H.! HA.href (H.toValue url) $ gos content- go (InlineLink url (Just title) content) = H.a H.! HA.href (H.toValue url) H.! HA.title (H.toValue title) $ gos content+ go (InlineLink url Nothing content)+ | msLinkNewTab ms = H.a H.! HA.href (H.toValue url) H.! HA.target "_blank" $ gos content+ | otherwise = H.a H.! HA.href (H.toValue url) $ gos content+ go (InlineLink url (Just title) content)+ | msLinkNewTab ms = H.a H.! HA.href (H.toValue url) H.! HA.title (H.toValue title) H.! HA.target "_blank" $ gos content+ | otherwise = H.a H.! HA.href (H.toValue url) H.! HA.title (H.toValue title) $ gos content go (InlineImage url Nothing content) = H.img H.! HA.src (H.toValue url) H.! HA.alt (H.toValue content) go (InlineImage url (Just title) content) = H.img H.! HA.src (H.toValue url) H.! HA.alt (H.toValue content) H.! HA.title (H.toValue title) go (InlineHtml t) = escape t
Text/Markdown/Types.hs view
@@ -65,6 +65,13 @@ -- <pre class="sourceCode"><code class="sourceCode">main <span class="fu">=</span> <span class="fu">putStrLn</span> <span class="st">"Hello world!"</span></code></pre> -- -- Since: 0.1.2.1+ , msLinkNewTab :: Bool+ -- ^ If @True@, all generated links have the attribute target=_blank set,+ -- causing them to be opened in a new tab or window.+ --+ -- Default: @False@+ --+ -- Since 0.1.4 } -- | See 'msFencedHandlers.@@ -84,6 +91,7 @@ \lang (_,rendered) -> case lang of Just l -> H.pre $ H.code H.! HA.class_ (H.toValue l) $ rendered Nothing -> H.pre $ H.code $ rendered+ , msLinkNewTab = False } -- | Helper for creating a 'FHRaw'.
markdown.cabal view
@@ -1,5 +1,5 @@ Name: markdown-Version: 0.1.3+Version: 0.1.4 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
@@ -156,6 +156,9 @@ it "not a link" $ check "<p>Not a [ link</p>" "Not a [ link"+ it "new tab" $ checkSet def { msLinkNewTab = True }+ "<p><a href=\"foo\" target=\"_blank\">bar</a></p>"+ "[bar](foo)" {- describe "github links" $ do