@@ -1381,8 +1381,14 @@ emph = fmap B.emph <$> nested
13811381 (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd)
13821382 where starStart = char '*' >> lookAhead nonspaceChar
13831383 starEnd = notFollowedBy' (() <$ strong) >> char '*'
1384− ulStart = char '_' >> lookAhead nonspaceChar
1384+ ulStart = checkIntraword >> char '_' >> lookAhead nonspaceChar
13851385 ulEnd = notFollowedBy' (() <$ strong) >> char '_'
1386+ checkIntraword = do
1387+ exts <- getOption readerExtensions
1388+ when (Ext_intraword_underscores `Set.member` exts) $ do
1389+ pos <- getPosition
1390+ lastStrPos <- stateLastStrPos <$> getState
1391+ guard $ lastStrPos /= Just pos
13861392
13871393strong :: MarkdownParser (F Inlines)
13881394strong = fmap B.strong <$> nested
@@ -1421,23 +1427,11 @@ nonEndline = satisfy (/='\n')
14211427
14221428str :: MarkdownParser (F Inlines)
14231429str = do
1424− isSmart <- getOption readerSmart
1425− intrawordUnderscores <- option False $
1426− True <$ guardEnabled Ext_intraword_underscores
1427− a <- alphaNum
1428− as <- many $ alphaNum
1429− <|> (if intrawordUnderscores
1430− then try (char '_' >>~ lookAhead alphaNum)
1431− else mzero)
1432− <|> if isSmart
1433− then (try $ satisfy (\c -> c == '\'' || c == '\x2019') >>
1434− lookAhead alphaNum >> return '\x2019')
1435− -- for things like l'aide
1436− else mzero
1430+ result <- many1 alphaNum
14371431 pos <- getPosition
14381432 updateState $ \s -> s{ stateLastStrPos = Just pos }
1439− let result = a:as
14401433 let spacesToNbr = map (\c -> if c == ' ' then '\160' else c)
1434+ isSmart <- getOption readerSmart
14411435 if isSmart
14421436 then case likelyAbbrev result of
14431437 [] -> return $ return $ B.str result