Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Python code blocks in the docs were rendering without syntax highlighting - all text displayed in a single color instead of distinct colors for keywords, strings, builtins, etc.

Changes

  • mkdocs.yml: Replaced pygments_lang_class: true with use_pygments: true in pymdownx.highlight config
    • pygments_lang_class: true adds language class but disables color styling
    • use_pygments: true enables server-side syntax highlighting with Material theme's color scheme
  • Added inline comment documenting the configuration choice

Before/After

Before: Code displayed as monochrome text

import httpr  # Everything in same grayish-purple color
response = httpr.get("https://httpbin.org/get")
print(response.json())

After: Proper syntax highlighting with distinct colors

  • Keywords (import, with) → blue
  • Strings → green
  • Builtins (print) → purple
  • Comments → gray

Screenshot of fixed homepage:
Fixed syntax highlighting

Original prompt

This section details on the original issue you should resolve

<issue_title>Bad formatting of docs</issue_title>
<issue_description>Look at https://thomasht86.github.io/httpr/ - the python code is wrongly formatted.
This was likely introduced in recent PRs.
Please build and verify docs are built and formatted correctly before creating a PR. </issue_description>

<agent_instructions>Try again now</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 5, 2026 08:08
Co-authored-by: thomasht86 <24563696+thomasht86@users.noreply.github.com>
…use_pygments

The issue was that pymdownx.highlight extension needed explicit use_pygments: true configuration.
Material for MkDocs now properly applies syntax highlighting colors to Python code blocks.

Co-authored-by: thomasht86 <24563696+thomasht86@users.noreply.github.com>
Co-authored-by: thomasht86 <24563696+thomasht86@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bad formatting of Python code in documentation Fix syntax highlighting in documentation Jan 5, 2026
Copilot AI requested a review from thomasht86 January 5, 2026 08:14
@thomasht86
Copy link
Owner

@thomasht86 thomasht86 closed this Jan 5, 2026
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.

Bad formatting of docs

2 participants