In writing Markdown, print unicode nonbreaking space

(160) as " ", since otherwise it is hard to distinguish
from a regular space.  (Addresses Issue #3.)


git-svn-id: https://pandoc.googlecode.com/svn/trunk@541 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2007-02-17 04:57:41 +00:00
parent 7a04caeea8
commit 7d3382e9f0

View file

@ -48,9 +48,16 @@ writeMarkdown options (Pandoc meta blocks) =
else empty in
render $ head <> body
-- | Escape nonbreaking space as &nbsp; entity
escapeNbsp "" = ""
escapeNbsp ('\160':xs) = "&nbsp;" ++ escapeNbsp xs
escapeNbsp str =
let (a,b) = break (=='\160') str in
a ++ escapeNbsp b
-- | Escape special characters for Markdown.
escapeString :: String -> String
escapeString = backslashEscape "`<\\*_^"
escapeString = backslashEscape "`<\\*_^" . escapeNbsp
-- | Take list of inline elements and return wrapped doc.
wrappedMarkdown :: [Inline] -> Doc