aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANUAL.txt13
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs8
-rw-r--r--test/command/5878.md7
3 files changed, 20 insertions, 8 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index 207f5a5ae..3b7bb544c 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -4042,12 +4042,13 @@ text by `~` characters. Thus, for example,
H~2~O is a liquid. 2^10^ is 1024.
-If the superscripted or subscripted text contains spaces, these spaces
-must be escaped with backslashes. (This is to prevent accidental
-superscripting and subscripting through the ordinary use of `~` and `^`.)
-Thus, if you want the letter P with 'a cat' in subscripts, use
-`P~a\ cat~`, not `P~a cat~`.
-
+The text between `^...^` or `~...~` may not contain spaces or
+newlines. If the superscripted or subscripted text contains
+spaces, these spaces must be escaped with backslashes. (This is
+to prevent accidental superscripting and subscripting through
+the ordinary use of `~` and `^`, and also bad interactions with
+footnotes.) Thus, if you want the letter P with 'a cat' in
+subscripts, use `P~a\ cat~`, not `P~a cat~`.
### Verbatim ###
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 46220acc8..4807baada 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1700,13 +1700,17 @@ superscript :: PandocMonad m => MarkdownParser m (F Inlines)
superscript = fmap B.superscript <$> try (do
guardEnabled Ext_superscript
char '^'
- mconcat <$> many1Till (notFollowedBy spaceChar >> inline) (char '^'))
+ mconcat <$> many1Till (do notFollowedBy spaceChar
+ notFollowedBy newline
+ inline) (char '^'))
subscript :: PandocMonad m => MarkdownParser m (F Inlines)
subscript = fmap B.subscript <$> try (do
guardEnabled Ext_subscript
char '~'
- mconcat <$> many1Till (notFollowedBy spaceChar >> inline) (char '~'))
+ mconcat <$> many1Till (do notFollowedBy spaceChar
+ notFollowedBy newline
+ inline) (char '~'))
whitespace :: PandocMonad m => MarkdownParser m (F Inlines)
whitespace = spaceChar >> return <$> (lb <|> regsp) <?> "whitespace"
diff --git a/test/command/5878.md b/test/command/5878.md
new file mode 100644
index 000000000..9e0f6bde3
--- /dev/null
+++ b/test/command/5878.md
@@ -0,0 +1,7 @@
+```
+% pandoc -t native
+Zozime^[],
+Synésius^[]
+^D
+[Para [Str "Zozime",Note [Para []],Str ",",SoftBreak,Str "Syn\233sius",Note [Para []]]]
+```