@@ -536,8 +536,8 @@ regularKey = try $ do
536536 -- inline
537537 --
538538
539−inline = choice [ escapedChar, link, image, hyphens, strong, emph,
540− superscript, subscript, code,
539+inline = choice [ superscript, subscript,
540+ escapedChar, link, image, hyphens, strong, emph, code,
541541 str, tabchar, whitespace, endline, symbol ] <?> "inline"
542542
543543hyphens = try (do
@@ -567,13 +567,15 @@ strong = do
567567 result <- enclosed (string "**") (string "**") inline
568568 return (Strong (normalizeSpaces result))
569569
570−superscript = do
571− result <- enclosed (string "\\ :sup:`") (string "`\\ ") anyChar
572− return (Superscript [Str result])
570+interpreted role = try $ do
571+ option "" (try $ string "\\ ")
572+ result <- enclosed (string $ ":" ++ role ++ ":`") (char '`') anyChar
573+ nextChar <- lookAhead anyChar
574+ try (string "\\ ") <|> lookAhead (count 1 $ oneOf " \t\n") <|> (eof >> return "")
575+ return [Str result]
573576
574−subscript = do
575− result <- enclosed (string "\\ :sub:`") (string "`\\ ") anyChar
576− return (Subscript [Str result])
577+superscript = interpreted "sup" >>= (return . Superscript)
578+subscript = interpreted "sub" >>= (return . Subscript)
577579
578580whitespace = do
579581 many1 spaceChar <?> "whitespace"