Skip to content

Handle invalid formatter options when printing styles - #3315

Open
yuefdev wants to merge 1 commit into
pygments:masterfrom
yuefdev:fix-style-option-errors
Open

yuefdev wants to merge 1 commit into
pygments:masterfrom
yuefdev:fix-style-option-errors

Conversation

@yuefdev

@yuefdev yuefdev commented Sep 13, 2026

Copy link
Copy Markdown

pygmentize -S default -f html -O linenostart=invalid currently treats a bad formatter option as an unhandled highlighting error; adding -v raises the exception.

Handle OptionError when constructing the formatter for -S, as the normal highlighting path already does. Invalid options now print the actionable error and return exit code 1. Regression tests cover both normal and verbose mode.

Validation: uv tool run tox -e py passed (5332 tests, 16 skipped). Both new cases failed before the fix. Ruff 0.15.2 and git diff --check passed.

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.

1 participant