@@ -36,6 +36,7 @@ import Text.Highlighting.Kate ( languages, highlightAs, formatAsHtml, FormatOpti
36import Data.List (find)
36import Data.List (find)
37import Data.Maybe (fromMaybe)
37import Data.Maybe (fromMaybe)
38import Data.Char (toLower)
38import Data.Char (toLower)
39+import qualified Text.Blaze.Html5.Attributes as A
40highlightHtml :: Bool -- ^ True if inline HTML
41highlightHtml :: Bool -- ^ True if inline HTML
41 -> Attr -- ^ Attributes of the Code or CodeBlock
42 -> Attr -- ^ Attributes of the Code or CodeBlock
@@ -52,12 +53,14 @@ highlightHtml inline (id', classes, keyvals) rawCode =
52 Just _ -> [OptNumberLines]
53 Just _ -> [OptNumberLines]
53 addBirdTracks = "literate" `elem` classes
54 addBirdTracks = "literate" `elem` classes
54 lcLanguages = map (map toLower) languages
55 lcLanguages = map (map toLower) languages
56+ addId = if null id' then id else (! A.id (toValue id'))
55 in case find (\c -> (map toLower c) `elem` lcLanguages) classes of
57 in case find (\c -> (map toLower c) `elem` lcLanguages) classes of
56 Nothing -> Left "Unknown or unsupported language"
58 Nothing -> Left "Unknown or unsupported language"
57 Just language -> case highlightAs language rawCode of
59 Just language -> case highlightAs language rawCode of
58 Left err -> Left err
60 Left err -> Left err
61+ Right hl -> Right $ addId
59− Right hl -> Right $ formatAsHtml fmtOpts language $
62+ $ formatAsHtml fmtOpts language
60− if addBirdTracks
63+ $ if addBirdTracks
61 then map (("ot","> "):) hl
64 then map (("ot","> "):) hl