aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-08-26 20:00:15 -0700
committerJohn MacFarlane <[email protected]>2022-08-26 20:01:01 -0700
commite3978247ccda4c07244e3940f7786e029bce7fae (patch)
tree46d6f789e72acc9fff5df444fb0f784385c116cb /src/Text
parent6a7ab9bb4e3e67e96e1bc02b287200f063c2eaee (diff)
HTML writer: avoid aria-hidden in code blocks for HTML4.
Closes #8241. This requires depending on a new (still unreleased) version of skylighting-format-blaze-html.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Highlighting.hs1
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs8
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs
index fac99cbcd..2d87033f6 100644
--- a/src/Text/Pandoc/Highlighting.hs
+++ b/src/Text/Pandoc/Highlighting.hs
@@ -20,6 +20,7 @@ module Text.Pandoc.Highlighting ( highlightingStyles
, styleToLaTeX
, formatHtmlInline
, formatHtmlBlock
+ , formatHtml4Block
, styleToCss
, pygments
, espresso
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 9481e2608..85864b963 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -46,8 +46,8 @@ import Text.Blaze.Html hiding (contents)
import Text.Pandoc.Translations (Term(Abstract))
import Text.Pandoc.CSS (cssAttributes)
import Text.Pandoc.Definition
-import Text.Pandoc.Highlighting (formatHtmlBlock, formatHtmlInline, highlight,
- styleToCss)
+import Text.Pandoc.Highlighting (formatHtmlBlock, formatHtml4Block,
+ formatHtmlInline, highlight, styleToCss)
import Text.Pandoc.ImageSize
import Text.Pandoc.Options
import Text.Pandoc.Shared
@@ -934,6 +934,7 @@ blockToHtmlInner _ HorizontalRule = do
html5 <- gets stHtml5
return $ if html5 then H5.hr else H.hr
blockToHtmlInner opts (CodeBlock (id',classes,keyvals) rawCode) = do
+ html5 <- gets stHtml5
id'' <- if T.null id'
then do
modify $ \st -> st{ stCodeBlockNum = stCodeBlockNum st + 1 }
@@ -952,7 +953,8 @@ blockToHtmlInner opts (CodeBlock (id',classes,keyvals) rawCode) = do
then T.unlines . map ("> " <>) . T.lines $ rawCode
else rawCode
hlCode = if isJust (writerHighlightStyle opts)
- then highlight (writerSyntaxMap opts) formatHtmlBlock
+ then highlight (writerSyntaxMap opts)
+ (if html5 then formatHtmlBlock else formatHtml4Block)
(id'',classes',keyvals) adjCode
else Left ""
case hlCode of