Support lineAnchors
(or line-anchors
) in code blocks, for HTML.
This commit is contained in:
parent
856587ff63
commit
5dfe131ee0
2 changed files with 8 additions and 0 deletions
|
@ -2008,6 +2008,12 @@ block above will appear as follows:
|
|||
</code>
|
||||
</pre>
|
||||
|
||||
The `numberLines` (or `number-lines`) class will cause the lines
|
||||
of the code block to be numbered, starting with `1` or the value
|
||||
of the `startFrom` attribute. The `lineAnchors` (or
|
||||
`line-anchors`) class will cause the lines to be clickable
|
||||
anchors in HTML output.
|
||||
|
||||
A shortcut form can also be used for specifying the language of
|
||||
the code block:
|
||||
|
||||
|
|
|
@ -85,6 +85,8 @@ 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,
|
||||
lineIdPrefix = if null ident
|
||||
|
|
Loading…
Add table
Reference in a new issue