hl_lines always relative

Create issue
Issue #1252 new
Former user created an issue

HtmlFormatter let's set starting line number with linenostart param, yet ignores linenostart when dealing with hl_lines.

STR:

linenostart = 10
hl_lines = [11]
formatter = HtmlFormatter(linenos=True, linenostart=linenostart, hl_lines=hl_lines)
highlight('a\nb\nc\n', lexer, formatter)

ER: line number 11 highlighted

AR: nothing highlighted

workaround I'm forced to use

linenostart=10
hl_lines = [11]
hl_lines=[l - linenostart + 1 for l in hl_lines] 
formatter = HtmlFormatter(linenos=True, linenostart=linenostart, hl_lines=hl_lines)
highlight('a\nb\nc\n', lexer, formatter)

Comments (0)

  1. Log in to comment