Line number separator always displayed with ImageFormatter, despite of `line_number_separator` value

Issue #1426 new
created an issue


I think there's a problem with the ImageFormatter . Indeed, it seems that the line number separator is always displayed, even if the attribute line_number_separator is set as False.

Here's an example code:

from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import ImageFormatter
from io import BytesIO
from PIL import Image

code = "print('hello world!')"

lexer = get_lexer_by_name("python", stripall=True)

formatter_1 = ImageFormatter(linenos=True, line_number_separator=True)
formatter_2 = ImageFormatter(linenos=True, line_number_separator=False)

result_1 = highlight(code, lexer, formatter_1)
result_2 = highlight(code, lexer, formatter_2)

im_1 =
im_2 ="image_1.png")"image_2.png")

Here's image_1.png: image_1.png

Here's image_2.png: image_2.png

Comments (0)

  1. Log in to comment