Skip to content

Codeblocks broken: TypeError: BlockHtmlFormatter.wrap() missing 1 required positional argument: 'outfile' #28

@jose1711

Description

@jose1711
```
foo
```

Renders the following error:

  File "markdowneditor/lib/python3.12/site-packages/pygments/__init__.py", line 82, in highlight
    return format(lex(code, lexer), formatter, outfile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "markdowneditor/lib/python3.12/site-packages/pygments/__init__.py", line 64, in format
    formatter.format(tokens, realoutfile)
  File "markdowneditor/lib/python3.12/site-packages/pygments/formatter.py", line 124, in format
    return self.format_unencoded(tokensource, outfile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "markdowneditor/lib/python3.12/site-packages/pygments/formatters/html.py", line 979, in format_unencoded
    source = self.wrap(source)
             ^^^^^^^^^^^^^^^^^
TypeError: BlockHtmlFormatter.wrap() missing 1 required positional argument: 'outfile'
127.0.0.1 - - [12/Jul/2024 09:41:07] "POST /ajax/preview HTTP/1.1" 500 753

A workaround is to downgrade Pygments to version 2.11.2 which seems to be the last compatible version.

pip install Pygments==2.11.2

Seems related to pygments/pygments#2101

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions