Skip to content

Commit 06f07ac

Browse files
committed
skylighting-format-blaze-html: include container classes on inline code.
In block code, these are put on the pre, but in inline code there is only a code element; they should not just be dropped. See jgm/pandoc#11423.
1 parent e223d28 commit 06f07ac

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • skylighting-format-blaze-html/src/Skylighting/Format

skylighting-format-blaze-html/src/Skylighting/Format/HTML.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module Skylighting.Format.HTML (
1010
import Data.List (intersperse, sort)
1111
import qualified Data.Map as Map
1212
import qualified Data.Text as Text
13+
import Data.Containers.ListUtils (nubOrd)
1314
import Skylighting.Types
1415
import Text.Blaze.Html
1516
import qualified Text.Blaze.Html5 as H
@@ -54,7 +55,8 @@ import Data.Semigroup
5455
-- 'WarningTok' = @wa@.
5556
-- A 'NormalTok' is not marked up at all.
5657
formatHtmlInline :: FormatOptions -> [SourceLine] -> Html
57-
formatHtmlInline opts = wrapCode opts
58+
formatHtmlInline opts = wrapCode opts{ codeClasses = nubOrd $ codeClasses opts ++
59+
containerClasses opts }
5860
. mconcat . intersperse (toHtml "\n")
5961
. map (mapM_ (tokenToHtml opts))
6062

@@ -90,8 +92,9 @@ formatHtmlBlockFor htmlVersion opts ls =
9092

9193
wrapCode :: FormatOptions -> Html -> Html
9294
wrapCode opts h = H.code ! A.class_ (toValue $ Text.unwords
93-
$ Text.pack "sourceCode"
94-
: codeClasses opts)
95+
(Text.pack "sourceCode"
96+
: filter (/= Text.pack "sourceCode")
97+
(codeClasses opts)))
9598
!? (startZero /= 0, A.style (toValue counterOverride))
9699
$ h
97100
where counterOverride = "counter-reset: source-line " <> show startZero <> ";"

0 commit comments

Comments
 (0)