aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Highlighting.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Highlighting.hs')
-rw-r--r--src/Text/Pandoc/Highlighting.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs
index cc72967e4..9c90b229e 100644
--- a/src/Text/Pandoc/Highlighting.hs
+++ b/src/Text/Pandoc/Highlighting.hs
@@ -81,12 +81,17 @@ highlight :: SyntaxMap
-> Attr -- ^ Attributes of the CodeBlock
-> String -- ^ Raw contents of the CodeBlock
-> Either String a
-highlight syntaxmap formatter (_, classes, keyvals) rawCode =
+highlight syntaxmap formatter (ident, classes, keyvals) rawCode =
let firstNum = fromMaybe 1 (safeRead (fromMaybe "1" $ lookup "startFrom" keyvals))
fmtOpts = defaultFormatOpts{
startNumber = firstNum,
+ lineAnchors = any (`elem`
+ ["line-anchors", "lineAnchors"]) classes,
numberLines = any (`elem`
- ["number","numberLines", "number-lines"]) classes }
+ ["number","numberLines", "number-lines"]) classes,
+ lineIdPrefix = if null ident
+ then mempty
+ else T.pack (ident ++ "-") }
tokenizeOpts = TokenizerConfig{ syntaxMap = syntaxmap
, traceOutput = False }
classes' = map T.pack classes