@@ -214,7 +214,8 @@ writeDocx opts doc@(Pandoc meta _) = do
214214 let newstyles = styleToOpenXml $ writerHighlightStyle opts
215215 let stylepath = "word/styles.xml"
216216 styledoc <- parseXml refArchive stylepath
217− let styledoc' = styledoc{ elContent = elContent styledoc ++ map Elem newstyles }
217+ let styledoc' = styledoc{ elContent = elContent styledoc ++
218+ [Elem x | x <- newstyles, writerHighlight opts] }
218219 let styleEntry = toEntry stylepath epochtime $ renderXml styledoc'
219220
220221 -- construct word/numbering.xml
@@ -665,13 +666,16 @@ inlineToOpenXML opts (Math mathType str) = do
665666 Right r -> return [r]
666667 Left _ -> inlinesToOpenXML opts (readTeXMath str)
667668inlineToOpenXML opts (Cite _ lst) = inlinesToOpenXML opts lst
668−inlineToOpenXML _ (Code attrs str) =
669+inlineToOpenXML opts (Code attrs str) =
669670 withTextProp (rStyle "VerbatimChar")
670− $ case highlight formatOpenXML attrs str of
671− Nothing -> intercalate [br]
672− `fmap` (mapM formattedString $ lines str)
673− Just h -> return h
674− where formatOpenXML _fmtOpts = intercalate [br] . map (map toHlTok)
671+ $ if writerHighlight opts
672+ then case highlight formatOpenXML attrs str of
673+ Nothing -> unhighlighted
674+ Just h -> return h
675+ else unhighlighted
676+ where unhighlighted = intercalate [br] `fmap`
677+ (mapM formattedString $ lines str)
678+ formatOpenXML _fmtOpts = intercalate [br] . map (map toHlTok)
675679 toHlTok (toktype,tok) = mknode "w:r" []
676680 [ mknode "w:rPr" []
677681 [ rStyle $ show toktype ]