aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-08 23:54:15 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-08 23:54:15 +0000
commitd83b70f3a0d72c322b2c0da3c78d4478c20f7f93 (patch)
treee98d8ac06ebfabc9185db402046633cb99eeb1d3 /src/Text/Pandoc
parent3d0ee324f3063decbc12b15068e3e7ce388b89b1 (diff)
downloadpandoc-d83b70f3a0d72c322b2c0da3c78d4478c20f7f93.tar.gz
+ Changed 'escapedChar' in Markdown reader so that only the
characters Markdown escapes are escaped in strict mode. When not in strict mode, Pandoc allows all non-alphanumeric characters to be escaped. + Added documentation of backslash escapes to README. git-svn-id: https://pandoc.googlecode.com/svn/trunk@461 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index f72918a0e..4e6a7b39c 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -32,6 +32,7 @@ module Text.Pandoc.Readers.Markdown (
) where
import Data.List ( findIndex, sortBy )
+import Data.Char ( isAlphaNum )
import Text.ParserCombinators.Pandoc
import Text.Pandoc.Definition
import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXEnvironment )
@@ -535,7 +536,13 @@ inline = choice [ rawLaTeXInline', escapedChar, special, text ] <?> "inline"
special = choice [ noteRef, inlineNote, link, referenceLink, rawHtmlInline',
autoLink, image ] <?> "link, inline html, note, or image"
-escapedChar = escaped anyChar
+escapedChar = try $ do
+ char '\\'
+ state <- getState
+ result <- if stateStrict state
+ then oneOf "\\`*_{}[]()>#+-.!"
+ else satisfy (not . isAlphaNum)
+ return (Str [result])
ltSign = try (do
notFollowedBy (noneOf "<") -- continue only if it's a <