Skip to content

Document a custom Pygments style configuration example - #14722

Closed
mustafacicek-eee wants to merge 1 commit into
sphinx-doc:masterfrom
mustafacicek-eee:docs-custom-pygments-style
Closed

mustafacicek-eee wants to merge 1 commit into
sphinx-doc:masterfrom
mustafacicek-eee:docs-custom-pygments-style

Conversation

@mustafacicek-eee

Copy link
Copy Markdown

Purpose

Document how to configure a custom Pygments style through pygments_style. The example defines ProjectStyle in an importable module, adds the module directory to sys.path using a path anchored to conf.py, and selects the style by its fully qualified string name. It copies DefaultStyle.styles so that changing comments and keywords preserves the other default token styles.

The change adds 35 lines to doc/usage/configuration.rst.

References

Validation

Run locally on macOS with Python 3.14.8, Sphinx 9.1.1, Pygments 2.21.0 and Docutils 0.22.4:

  • sphinx-lint doc/usage/configuration.rst passed.
  • pytest tests/test_highlighting.py -q: 5 passed.
  • Full documentation HTML and text builds passed with warnings treated as errors. The HTML build used Graphviz 16.1.0.
  • The exact two Python snippets were extracted from the documentation and used to build an example from a different working directory with -W. Generated HTML/CSS contained the expected comment and keyword styles, and an unchanged string token retained its default style.
  • The full Python test suite did not pass in this environment: both the modified tree and the unchanged base produced 2388 passed, 5 failed and 33 skipped, with some differing failures between runs. A serial rerun of the combined seven failing tests on both trees produced the same four failures and three passes. This is not a claim that the full suite passes.

AI Disclosure

OpenAI Codex researched the issue, generated all 35 added documentation lines (including both Python examples), executed the validation, and generated this PR title and description. At the account owner's explicit request, Codex also created the branch and submitted this draft PR.

This submission does not claim that the account owner personally wrote the change or performed a human review. Sphinx's AI policy requires human review, human submission and human-written communication; this automated draft does not establish that those requirements have been met. It is therefore left as a draft.

AI-assisted implementation and validation by OpenAI Codex.
@mustafacicek-eee
mustafacicek-eee deleted the docs-custom-pygments-style branch October 9, 2026 20:18
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