@@ -36,6 +36,7 @@ import Text.Highlighting.Kate ( languages, highlightAs, formatAsHtml, FormatOpti
3636import Data.List (find)
3737import Data.Maybe (fromMaybe)
3838import Data.Char (toLower)
39+import qualified Text.Blaze.Html5.Attributes as A
3940
4041highlightHtml :: Bool -- ^ True if inline HTML
4142 -> Attr -- ^ Attributes of the Code or CodeBlock
@@ -52,12 +53,14 @@ highlightHtml inline (id', classes, keyvals) rawCode =
5253 Just _ -> [OptNumberLines]
5354 addBirdTracks = "literate" `elem` classes
5455 lcLanguages = map (map toLower) languages
56+ addId = if null id' then id else (! A.id (toValue id'))
5557 in case find (\c -> (map toLower c) `elem` lcLanguages) classes of
5658 Nothing -> Left "Unknown or unsupported language"
5759 Just language -> case highlightAs language rawCode of
5860 Left err -> Left err
59− Right hl -> Right $ formatAsHtml fmtOpts language $
60− if addBirdTracks
61+ Right hl -> Right $ addId
62+ $ formatAsHtml fmtOpts language
63+ $ if addBirdTracks
6164 then map (("ot","> "):) hl
6265 else hl
6366