From 7d3382e9f020f05afc76bd1afcee4af4914c51fe Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 17 Feb 2007 04:57:41 +0000 Subject: 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 --- src/Text/Pandoc/Writers/Markdown.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 4d3f844b5..13e5aca89 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -48,9 +48,16 @@ writeMarkdown options (Pandoc meta blocks) = else empty in render $ head <> body +-- | Escape nonbreaking space as   entity +escapeNbsp "" = "" +escapeNbsp ('\160':xs) = " " ++ 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 -- cgit v1.2.3