@@ -42,6 +42,7 @@ import Text.Pandoc.Builder (Inlines, Blocks, trimInlines, (<>))
4242import Text.Pandoc.Options
4343import Text.Pandoc.Shared
4444import Text.Pandoc.XML (fromEntities)
45+import Text.Pandoc.Asciify (toAsciiChar)
4546import Text.Pandoc.Parsing hiding (tableWith)
4647import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
4748import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
@@ -397,10 +398,15 @@ addToHeaderList (ident,classes,kvs) text = do
397398 then do
398399 ids <- stateIdentifiers `fmap` getState
399400 let id' = uniqueIdent (B.toList header') ids
401+ let id'' = if Ext_ascii_identifiers `Set.member` exts
402+ then catMaybes $ map toAsciiChar id'
403+ else id'
400404 updateState $ \st -> st{
401− stateIdentifiers = id' : ids,
405+ stateIdentifiers = if id' == id''
406+ then id' : ids
407+ else id' : id'' : ids,
402408 stateHeaders = insert' header' id' $ stateHeaders st }
403− return (id',classes,kvs)
409+ return (id'',classes,kvs)
404410 else do
405411 unless (null ident) $
406412 updateState $ \st -> st{