yesod-markdown 0.0 → 0.1
raw patch · 2 files changed
+9/−15 lines, 2 filesdep −xss-sanitize
Dependencies removed: xss-sanitize
Files
- Yesod/Markdown.hs +8/−13
- yesod-markdown.cabal +1/−2
Yesod/Markdown.hs view
@@ -8,7 +8,6 @@ , parseMarkdown , localLinks , writePandoc- , writePandocTrusted -- * Option sets , yesodDefaultWriterOptions , yesodDefaultParserState@@ -22,7 +21,6 @@ import Yesod.Form.Core import Text.Pandoc import Text.Pandoc.Shared-import Text.HTML.SanitizeXSS import Control.Applicative import Data.Map ( Map ) import qualified Data.Map as Map@@ -58,13 +56,9 @@ |] } --- | Write untrusted 'Pandoc' to 'Html'. Calls 'sanitizeBalance' from xss-sanitize.+-- | Write 'Pandoc' to 'Html'. writePandoc :: WriterOptions -> Pandoc -> Html-writePandoc wo = preEscapedString . sanitizeBalance . writeHtmlString wo---- | Write trusted 'Pandoc' to 'Html'. Does not sanitize or balance tags.-writePandocTrusted :: WriterOptions -> Pandoc -> Html-writePandocTrusted wo = preEscapedString . writeHtmlString wo+writePandoc wo = preEscapedString . writeHtmlString wo -- | Read in 'Markdown' to an intermediate 'Pandoc' type. parseMarkdown :: ParserState -> Markdown -> Pandoc@@ -89,11 +83,12 @@ , writerWrapText = False } --- | A set of default Pandoc reader options good for Yesod websites /where the data input is trusted/. Enables raw--- HTML.+-- | A set of default Pandoc reader options good for Yesod websites /where the data input is trusted/. Disables+-- HTML sanitization and enables smart parsing and raw HTML parsing. yesodDefaultParserStateTrusted :: ParserState-yesodDefaultParserStateTrusted = yesodDefaultParserState { stateParseRaw = True }+yesodDefaultParserStateTrusted = yesodDefaultParserState { stateSanitizeHTML = False } --- | A set of default Pandoc reader options good for Yesod websites. Enables smart parsing.+-- | A set of default Pandoc reader options good for Yesod websites. Enables smart parsing, raw HTML parsing, and+-- HTML sanitization. yesodDefaultParserState :: ParserState-yesodDefaultParserState = defaultParserState { stateSmart = True }+yesodDefaultParserState = defaultParserState { stateSmart = True, stateParseRaw = True, stateSanitizeHTML = True }
yesod-markdown.cabal view
@@ -2,7 +2,7 @@ -- options, see -- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr. Name: yesod-markdown-Version: 0.0+Version: 0.1 Synopsis: Markdown processing for Yesod sites using Pandoc Description: Process Markdown in Yesod sites. License: BSD3@@ -32,7 +32,6 @@ Build-depends: yesod , pandoc , containers- , xss-sanitize , bytestring , utf8-string