git.iko.soy/typeable/pandoc
on master help sign in
Support `lineAnchors` (or `line-anchors`) in code blocks, for HTML.
commit5dfe131ee07065dc7b68912d9a068508e29e18a4 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 2 Nov 2017, 16:38 (9 years ago) parent856587f
2 files changed+8
MANUAL.txt+6 src/Text/Pandoc/Highlighting.hs+2
MANUAL.txt+6
@@ -2008,6 +2008,12 @@ block above will appear as follows:
20082008 </code>
20092009 </pre>
20102010
2011+The `numberLines` (or `number-lines`) class will cause the lines
2012+of the code block to be numbered, starting with `1` or the value
2013+of the `startFrom` attribute. The `lineAnchors` (or
2014+`line-anchors`) class will cause the lines to be clickable
2015+anchors in HTML output.
2016+
20112017A shortcut form can also be used for specifying the language of
20122018the code block:
20132019
src/Text/Pandoc/Highlighting.hs+2
@@ -85,6 +85,8 @@ highlight syntaxmap formatter (ident, classes, keyvals) rawCode =
8585 let firstNum = fromMaybe 1 (safeRead (fromMaybe "1" $ lookup "startFrom" keyvals))
8686 fmtOpts = defaultFormatOpts{
8787 startNumber = firstNum,
88+ lineAnchors = any (`elem`
89+ ["line-anchors", "lineAnchors"]) classes,
8890 numberLines = any (`elem`
8991 ["number","numberLines", "number-lines"]) classes,
9092 lineIdPrefix = if null ident