git.iko.soy/typeable/pandoc
on master help sign in
Checking options before applying syntax highlighting for HTML output
commit6a235ba60693596af3f13b093b83defa37501e09 authorAlexander Kondratskiy <kholdstare0.0@gmail.com> dateSat 13 Jul 2013, 02:23 (13 years ago) parentbd1079e
1 file changed+9−3
src/Text/Pandoc/Writers/HTML.hs+9−3
src/Text/Pandoc/Writers/HTML.hs+9−3
@@ -422,7 +422,10 @@ blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
422422 adjCode = if tolhs
423423 then unlines . map ("> " ++) . lines $ rawCode
424424 else rawCode
425− case highlight formatHtmlBlock (id',classes',keyvals) adjCode of
425+ hlCode = if writerHighlight opts -- check highlighting options
426+ then highlight formatHtmlBlock (id',classes',keyvals) adjCode
427+ else Nothing
428+ case hlCode of
426429 Nothing -> return $ addAttrs opts (id',classes,keyvals)
427430 $ H.pre $ H.code $ toHtml adjCode
428431 Just h -> modify (\st -> st{ stHighlighting = True }) >>
@@ -589,14 +592,17 @@ inlineToHtml opts inline =
589592 (LineBreak) -> return $ if writerHtml5 opts then H5.br else H.br
590593 (Emph lst) -> inlineListToHtml opts lst >>= return . H.em
591594 (Strong lst) -> inlineListToHtml opts lst >>= return . H.strong
592− (Code attr str) -> case highlight formatHtmlInline attr str of
595+ (Code attr str) -> case hlCode of
593596 Nothing -> return
594597 $ addAttrs opts attr
595598 $ H.code $ strToHtml str
596599 Just h -> do
597600 modify $ \st -> st{ stHighlighting = True }
598601 return $ addAttrs opts (id',[],keyvals) h
599− where (id',_,keyvals) = attr
602+ where (id',_,keyvals) = attr
603+ hlCode = if writerHighlight opts
604+ then highlight formatHtmlInline attr str
605+ else Nothing
600606 (Strikeout lst) -> inlineListToHtml opts lst >>=
601607 return . H.del
602608 (SmallCaps lst) -> inlineListToHtml opts lst >>=