File tree Expand file tree Collapse file tree
skylighting-format-blaze-html/src/Skylighting/Format Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ module Skylighting.Format.HTML (
1010import Data.List (intersperse , sort )
1111import qualified Data.Map as Map
1212import qualified Data.Text as Text
13+ import Data.Containers.ListUtils (nubOrd )
1314import Skylighting.Types
1415import Text.Blaze.Html
1516import 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.
5657formatHtmlInline :: 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
9193wrapCode :: FormatOptions -> Html -> Html
9294wrapCode 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 <> " ;"
You can’t perform that action at this time.
0 commit comments