@@ -915,14 +915,8 @@ inlineToMarkdown opts (Superscript lst) =
915915 then "^" <> contents <> "^"
916916 else if isEnabled Ext_raw_html opts
917917 then "<sup>" <> contents <> "</sup>"
918− else case (render Nothing contents) of
919− ds | all (\d -> d >= '0' && d <= '9') ds
920− -> text (map toSuperscript ds)
921− _ -> contents
922− where toSuperscript '1' = '\x00B9'
923− toSuperscript '2' = '\x00B2'
924− toSuperscript '3' = '\x00B3'
925− toSuperscript c = chr (0x2070 + (ord c - 48))
918+ else text $ map toSuperscript
919+ $ render Nothing contents
926920inlineToMarkdown opts (Subscript lst) =
927921 local (\env -> env {envEscapeSpaces = True}) $ do
928922 contents <- inlineListToMarkdown opts lst
@@ -930,11 +924,8 @@ inlineToMarkdown opts (Subscript lst) =
930924 then "~" <> contents <> "~"
931925 else if isEnabled Ext_raw_html opts
932926 then "<sub>" <> contents <> "</sub>"
933− else case (render Nothing contents) of
934− ds | all (\d -> d >= '0' && d <= '9') ds
935− -> text (map toSubscript ds)
936− _ -> contents
937− where toSubscript c = chr (0x2080 + (ord c - 48))
927+ else text $ map toSubscript
928+ $ render Nothing contents
938929inlineToMarkdown opts (SmallCaps lst) = do
939930 plain <- asks envPlain
940931 if not plain &&
@@ -1129,3 +1120,28 @@ makeMathPlainer = walk go
11291120 go (Emph xs) = Span nullAttr xs
11301121 go x = x
11311122
1123+toSuperscript :: Char -> Char
1124+toSuperscript '1' = '\x00B9'
1125+toSuperscript '2' = '\x00B2'
1126+toSuperscript '3' = '\x00B3'
1127+toSuperscript '+' = '\x207A'
1128+toSuperscript '-' = '\x207B'
1129+toSuperscript '=' = '\x207C'
1130+toSuperscript '(' = '\x207D'
1131+toSuperscript ')' = '\x207E'
1132+toSuperscript c
1133+ | c >= '0' && c <= '9' =
1134+ chr (0x2070 + (ord c - 48))
1135+ | otherwise = c
1136+
1137+toSubscript :: Char -> Char
1138+toSubscript '+' = '\x208A'
1139+toSubscript '-' = '\x208B'
1140+toSubscript '=' = '\x208C'
1141+toSubscript '(' = '\x208D'
1142+toSubscript ')' = '\x208E'
1143+toSubscript c
1144+ | c >= '0' && c <= '9' =
1145+ chr (0x2080 + (ord c - 48))
1146+ | otherwise = c
1147+