Skip to content

Upgrading to Pygments 2.20.0 makes mkdocs build crash #4098

@LucaNicosia

Description

@LucaNicosia

Hi everyone,

Given CVE-2026-4539 affecting pygments. I decided to force the version 2.20.0 to solve this CVE.

After doing this upgrade, I get this error when running mkdocs build -d dist/docs

  File "/home/luca/.cache/pypoetry/virtualenvs/my-project/lib/python3.11/site-packages/pygments/formatters/html.py", line 434, in __init__
    self.filename = html.escape(self._decodeifneeded(options.get('filename', '')))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/riccardo/.pyenv/versions/3.11.13/lib/python3.11/html/__init__.py", line 19, in escape
    s = s.replace("&", "&") # Must be done first!
        ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

Rolling back to any previous version fixes the problem.

Any suggestion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions