@@ -394,7 +394,7 @@ writeDocx opts doc@(Pandoc meta _) = do
394394 linkrels
395395
396396 -- styles
397− let newstyles = styleToOpenXml $ writerHighlightStyle opts
397+ let newstyles = styleToOpenXml charStyles $ writerHighlightStyle opts
398398 let styledoc' = styledoc{ elContent = elContent styledoc ++
399399 [Elem x | x <- newstyles, writerHighlight opts] }
400400 let styleEntry = toEntry stylepath epochtime $ renderXml styledoc'
@@ -473,10 +473,13 @@ writeDocx opts doc@(Pandoc meta _) = do
473473 miscRelEntries ++ otherMediaEntries
474474 return $ fromArchive archive
475475
476−styleToOpenXml :: Style -> [Element]
477−styleToOpenXml style = parStyle : map toStyle alltoktypes
476+styleToOpenXml :: CharStyleMap -> Style -> [Element]
477+styleToOpenXml (CharStyleMap m) style = parStyle : mapMaybe toStyle alltoktypes
478478 where alltoktypes = enumFromTo KeywordTok NormalTok
479− toStyle toktype = mknode "w:style" [("w:type","character"),
479+ toStyle toktype =
480+ if M.member (map toLower $ show toktype) m then Nothing
481+ else Just $
482+ mknode "w:style" [("w:type","character"),
480483 ("w:customStyle","1"),("w:styleId",show toktype)]
481484 [ mknode "w:name" [("w:val",show toktype)] ()
482485 , mknode "w:basedOn" [("w:val","VerbatimChar")] ()