git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: fix small super/subscript issue.
741b1f7John MacFarlane
MANUAL.txt+7−6
@@ -4042,12 +4042,13 @@ text by `~` characters. Thus, for example,
4042
4042
4043 H~2~O is a liquid. 2^10^ is 1024.
4043 H~2~O is a liquid. 2^10^ is 1024.
4044
4044
4045+The text between `^...^` or `~...~` may not contain spaces or
4045−If the superscripted or subscripted text contains spaces, these spaces
4046+newlines. If the superscripted or subscripted text contains
4046−must be escaped with backslashes. (This is to prevent accidental
4047+spaces, these spaces must be escaped with backslashes. (This is
4047−superscripting and subscripting through the ordinary use of `~` and `^`.)
4048+to prevent accidental superscripting and subscripting through
4049+the ordinary use of `~` and `^`, and also bad interactions with
4048−Thus, if you want the letter P with 'a cat' in subscripts, use
4050+footnotes.) Thus, if you want the letter P with 'a cat' in
4049−`P~a\ cat~`, not `P~a cat~`.
4051+subscripts, use `P~a\ cat~`, not `P~a cat~`.
4050−
4051
4052
4052### Verbatim ###
4053### Verbatim ###
4053
4054
src/Text/Pandoc/Readers/Markdown.hs+6−2
@@ -1700,13 +1700,17 @@ superscript :: PandocMonad m => MarkdownParser m (F Inlines)
1700superscript = fmap B.superscript <$> try (do
1700superscript = fmap B.superscript <$> try (do
1701 guardEnabled Ext_superscript
1701 guardEnabled Ext_superscript
1702 char '^'
1702 char '^'
1703− mconcat <$> many1Till (notFollowedBy spaceChar >> inline) (char '^'))
1703+ mconcat <$> many1Till (do notFollowedBy spaceChar
1704+ notFollowedBy newline
1705+ inline) (char '^'))
1704
1706
1705subscript :: PandocMonad m => MarkdownParser m (F Inlines)
1707subscript :: PandocMonad m => MarkdownParser m (F Inlines)
1706subscript = fmap B.subscript <$> try (do
1708subscript = fmap B.subscript <$> try (do
1707 guardEnabled Ext_subscript
1709 guardEnabled Ext_subscript
1708 char '~'
1710 char '~'
1709− mconcat <$> many1Till (notFollowedBy spaceChar >> inline) (char '~'))
1711+ mconcat <$> many1Till (do notFollowedBy spaceChar
1712+ notFollowedBy newline
1713+ inline) (char '~'))
1710
1714
1711whitespace :: PandocMonad m => MarkdownParser m (F Inlines)
1715whitespace :: PandocMonad m => MarkdownParser m (F Inlines)
1712whitespace = spaceChar >> return <$> (lb <|> regsp) <?> "whitespace"
1716whitespace = spaceChar >> return <$> (lb <|> regsp) <?> "whitespace"
test/command/5878.mdnew file+7
@@ -0,0 +1,7 @@
1+```
2+% pandoc -t native
3+Zozime^[],
4+Synésius^[]
5+^D
6+[Para [Str "Zozime",Note [Para []],Str ",",SoftBreak,Str "Syn\233sius",Note [Para []]]]
7+```