Fix codehilite null filename with Pygments 2.20 by marko1olo · Pull Request #4148 · mkdocs/mkdocs · GitHub
Skip to content

Fix codehilite null filename with Pygments 2.20#4148

Open
marko1olo wants to merge 1 commit into
mkdocs:masterfrom
marko1olo:fix-pygments-220-filename-none
Open

Fix codehilite null filename with Pygments 2.20#4148
marko1olo wants to merge 1 commit into
mkdocs:masterfrom
marko1olo:fix-pygments-220-filename-none

Conversation

@marko1olo

Copy link
Copy Markdown

Fixes #4098.

codehilite passes unknown options through to Pygments' HtmlFormatter. With Pygments 2.20, ilename: null crashes when the formatter escapes the value. MkDocs now normalizes only the explicit codehilite.filename: null case to an empty string, preserving other None values such as linenums: null.

Tests run:

  • python -m unittest mkdocs.tests.config.config_options_tests.MarkdownExtensionsTest mkdocs.tests.structure.page_tests.PageTests
  • python -m unittest mkdocs.tests.config.config_options_tests mkdocs.tests.structure.page_tests
  • python -m ruff check --ignore PLC0415 mkdocs\config\config_options.py mkdocs\tests\config\config_options_tests.py mkdocs\tests\structure\page_tests.py
  • git diff --check
  • python -m mkdocs build -f --strict with codehilite.filename: and Pygments 2.20.0

@marko1olo

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrading to Pygments 2.20.0 makes mkdocs build crash

1 participant