Skip to content

Improve Docs, Auto Generate Enums Index, and Modernize UI#68

Merged
5hojib merged 1 commit intobetafrom
improve-docs-ui-enums-16014549856798480274
Feb 11, 2026
Merged

Improve Docs, Auto Generate Enums Index, and Modernize UI#68
5hojib merged 1 commit intobetafrom
improve-docs-ui-enums-16014549856798480274

Conversation

@5hojib
Copy link
Member

@5hojib 5hojib commented Feb 11, 2026

I have improved the documentation by:

  1. Automating Enum Categorization: The compiler/docs/compiler.py now logically groups enums (General, Chats, Messages, etc.) in the index, making them easier to browse.
  2. Modernizing the UI: Updated the sphinx_immaterial theme configuration with faster navigation, better fonts (Inter for text, JetBrains Mono for code), and a more minimalist design.
  3. Visual Enhancements: Overhauled custom.css to include modern touches like header blur effects, pill-style badges, and cleaner tables/code blocks.
  4. Refining the Homepage: Updated the introduction page with a cleaner layout and quick-access buttons.
  5. Quality Improvement: Corrected a spelling error by renaming listerner_types.py to listener_types.py and updating its references.
  6. Full Regeneration: Ran all compilers to ensure the documentation is fully up-to-date with the latest code changes.

PR created automatically by Jules for task 16014549856798480274 started by @5hojib

Summary by Sourcery

Modernize the documentation UI and reorganize the enums documentation index for clearer navigation.

New Features:

  • Introduce categorized enums index pages, grouping enums into logical sections such as General, Chats, Messages, and others.
  • Add dedicated documentation for the ButtonStyle enum.

Bug Fixes:

  • Correct the ListenerTypes module naming typo by standardizing on listener_types across imports and exports.

Enhancements:

  • Refresh the custom documentation styling with a modernized header, typography, code blocks, tables, badges, scrollbars, and admonitions.
  • Update the Sphinx Immaterial theme configuration with new fonts, faster navigation, and improved code interaction features.

Documentation:

  • Regenerate the enums documentation index and related pages to reflect the new categorization and latest API surface.

- Updated `compiler/docs/compiler.py` to support categorized Enums.
- Enhanced documentation visuals with modern fonts (Inter, JetBrains Mono) and theme features (instant navigation).
- Refined `docs/source/_static/css/custom.css` for a modern minimalist UI with backdrop-filter blurs and improved typography.
- Improved `docs/source/index.rst` layout for a better first impression.
- Fixed typo in enum filename: renamed `listerner_types.py` to `listener_types.py`.
- Regenerated all API and documentation files.

Co-authored-by: 5hojib <107526130+5hojib@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 11, 2026

Reviewer's Guide

Updates the documentation build to auto-categorize enums, modernizes the Sphinx theme and custom CSS, refreshes the homepage and enum API pages, and fixes a listener types filename typo across the codebase.

Flow diagram for auto categorized enums index generation

flowchart TD
  A[Start pyrogram_api] --> B[Collect enums_list from pyrogram.enums]
  B --> C[Initialize categorized_enums and assigned_enums]
  C --> D[Iterate over ENUMS_CATEGORIES]
  D --> E[For each category title and enum list]
  E --> F[Filter enums present in enums_list]
  F --> G{Filtered list empty?}
  G -- Yes --> D
  G -- No --> H[Add sorted filtered list to categorized_enums]
  H --> I[Add enums to assigned_enums]
  I --> D

  D --> J[Compute others = enums_list minus assigned_enums]
  J --> K{others non empty?}
  K -- Yes --> L[Add Others category to categorized_enums]
  K -- No --> M[Skip Others category]

  L --> N[Iterate over categorized_enums items]
  M --> N

  N --> O[For each category: write section title and underline]
  O --> P[Write autosummary directive with category enums]
  P --> Q[Write hidden toctree entries for category enums]
  Q --> R[Repeat for all categories]

  R --> S[For each enum in enums_list]
  S --> T[Write individual enum .rst file]
  T --> U[End pyrogram_api]
Loading

File-Level Changes

Change Details Files
Auto-generate a categorized enums index during docs compilation.
  • Introduce a static ENUMS_CATEGORIES mapping of enum groups to enum names in the docs compiler
  • Adjust pyrogram_api() enum index generation to emit grouped sections with autosummary/toctree per category instead of a flat sorted list
  • Ensure uncategorized enums fall into an automatically generated "Others" group
compiler/docs/compiler.py
docs/source/api/enums/index.rst
docs/source/api/enums/ButtonStyle.rst
Modernize the docs site styling and navigation via Sphinx theme and CSS tweaks.
  • Refine sphinx_immaterial theme options to configure Inter and JetBrains Mono fonts and enable instant navigation, tracking, and code-copy/annotation features
  • Revamp custom CSS with header blur, updated typography, rounded code blocks, pill-style badges, improved tables, modern scrollbars, smoother theme transitions, and enhanced admonition styling
docs/source/conf.py
docs/source/_static/css/custom.css
Refresh top-level docs content and fix a listener types naming typo.
  • Update the documentation homepage structure/content to match the new design and quick-access patterns
  • Rename listerner_types.py to listener_types.py and update all references to fix the spelling error
docs/source/index.rst
pyrogram/enums/__init__.py
pyrogram/listener_types.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @5hojib, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the documentation experience by introducing automated categorization for enums, modernizing the user interface with updated styling and theme configurations, and refining the homepage layout. These changes aim to improve navigation, readability, and overall aesthetic appeal of the documentation.

Highlights

  • Automated Enum Categorization: The compiler/docs/compiler.py now logically groups enums (General, Chats, Messages, etc.) in the index, making them easier to browse.
  • Modernized UI Theme: The sphinx_immaterial theme configuration was updated with faster navigation, better fonts (Inter for text, JetBrains Mono for code), and a more minimalist design.
  • Enhanced Visuals: custom.css was overhauled to include modern touches like header blur effects, pill-style badges, and cleaner tables/code blocks.
  • Refined Homepage Layout: The introduction page (docs/source/index.rst) was updated with a cleaner layout and quick-access buttons.
  • Corrected Typo: A spelling error was fixed by renaming listerner_types.py to listener_types.py and updating its references.
Changelog
  • compiler/docs/compiler.py
    • Added ENUMS_CATEGORIES dictionary to define logical groupings for enums.
    • Modified pyrogram_api function to generate index.rst with categorized enum listings, replacing the single sorted list.
  • docs/source/_static/css/custom.css
    • Introduced modern header styling with backdrop-filter blur effect.
    • Updated typography with refined font sizes and weights for headings.
    • Applied rounded corners and subtle shadows to code blocks.
    • Redesigned .usable-by badges to a pill-style with updated colors and shadows.
    • Enhanced link styling for better visual feedback.
    • Improved table styling with separate borders, rounded corners, and updated padding/backgrounds.
    • Added custom modern scrollbar styling.
    • Included smoother transitions for theme toggling.
    • Applied styling to admonitions and details elements.
  • docs/source/api/enums/ButtonStyle.rst
    • Added a new reStructuredText file to document the ButtonStyle enum.
  • docs/source/api/enums/index.rst
    • Completely restructured the enum index to display enums grouped by categories (General, Chats, Messages, Users, Colors, Privacy, Polls, Business, Authentication, Reactions) instead of a single alphabetical list.
  • docs/source/conf.py
    • Configured sphinx_immaterial theme to use "Inter" for text and "JetBrains Mono" for code fonts.
    • Enabled additional sphinx_immaterial features: navigation.instant, navigation.tracking, content.code.copy, and content.code.annotate.
  • docs/source/index.rst
    • Refactored the raw HTML section for the homepage introduction, replacing simple links with styled buttons and a more modern layout.
    • Simplified the "How the Documentation is Organized" section by removing references to the "Next" button and theme toggle, focusing on sidebar access.
  • pyrogram/enums/init.py
    • Updated the import statement for ListenerTypes to reflect the corrected filename listener_types.py.
  • pyrogram/enums/listerner_types.py
    • Renamed the file to correct a spelling error from listerner_types.py to listener_types.py.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The ENUMS_CATEGORIES mapping in compiler/docs/compiler.py hard-codes enum names and categories, which can easily drift out of sync with the actual enums; consider deriving this list dynamically (e.g., via introspection or a simple config structure closer to the enums) or at least centralizing it so enums can be renamed/added without updating the compiler logic.
  • The new CSS introduces a 0.75rem base font size and heavy use of backdrop-filter blur, which can impact readability and performance on some devices; it might be worth revisiting these values (or adding prefers-reduced-motion/prefers-reduced-transparency-style guards) to keep the UI accessible and performant.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `ENUMS_CATEGORIES` mapping in `compiler/docs/compiler.py` hard-codes enum names and categories, which can easily drift out of sync with the actual enums; consider deriving this list dynamically (e.g., via introspection or a simple config structure closer to the enums) or at least centralizing it so enums can be renamed/added without updating the compiler logic.
- The new CSS introduces a 0.75rem base font size and heavy use of `backdrop-filter` blur, which can impact readability and performance on some devices; it might be worth revisiting these values (or adding `prefers-reduced-motion`/`prefers-reduced-transparency`-style guards) to keep the UI accessible and performant.

## Individual Comments

### Comment 1
<location> `docs/source/_static/css/custom.css:14-17` </location>
<code_context>
 }

+/* Modern Header with blur */
+.md-header {
+  backdrop-filter: blur(20px);
+  -webkit-backdrop-filter: blur(20px);
+  background-color: rgba(63, 81, 181, 0.85);
+}
+
</code_context>

<issue_to_address>
**suggestion (performance):** The use of `backdrop-filter` on the header can negatively impact performance and is not supported in all browsers without a clear fallback.

On sticky headers this level of blur can be costly, particularly on low‑end devices and during scroll, and some browsers will ignore it entirely. Consider adding a solid background fallback with a feature query (`@supports (backdrop-filter: blur(1px)) { ... }`), reducing the blur radius, or turning off the blur on small screens via media queries.
</issue_to_address>

### Comment 2
<location> `docs/source/index.rst:39` </location>
<code_context>
-in the top left corner.
-
-Here below you can, instead, find a list of the most relevant pages for a quick access.
+Contents are organized into sections composed of self-contained topics which can be all accessed from the sidebar.
+Here below you can find a list of the most relevant pages for quick access.

</code_context>

<issue_to_address>
**suggestion (typo):** Consider adjusting word order in "can be all accessed" for more natural phrasing.

The phrase "which can be all accessed from the sidebar" is understandable but slightly awkward. Consider "which can all be accessed from the sidebar" for more natural phrasing.

```suggestion
Contents are organized into sections composed of self-contained topics which can all be accessed from the sidebar.
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +14 to +17
.md-header {
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
background-color: rgba(63, 81, 181, 0.85);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): The use of backdrop-filter on the header can negatively impact performance and is not supported in all browsers without a clear fallback.

On sticky headers this level of blur can be costly, particularly on low‑end devices and during scroll, and some browsers will ignore it entirely. Consider adding a solid background fallback with a feature query (@supports (backdrop-filter: blur(1px)) { ... }), reducing the blur radius, or turning off the blur on small screens via media queries.

in the top left corner.

Here below you can, instead, find a list of the most relevant pages for a quick access.
Contents are organized into sections composed of self-contained topics which can be all accessed from the sidebar.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (typo): Consider adjusting word order in "can be all accessed" for more natural phrasing.

The phrase "which can be all accessed from the sidebar" is understandable but slightly awkward. Consider "which can all be accessed from the sidebar" for more natural phrasing.

Suggested change
Contents are organized into sections composed of self-contained topics which can be all accessed from the sidebar.
Contents are organized into sections composed of self-contained topics which can all be accessed from the sidebar.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the documentation by automating the generation of a categorized enum index, modernizing the UI with a new theme configuration and custom CSS, and refining the homepage layout. The changes make the documentation more organized and visually appealing. I've found a couple of areas for improvement in the CSS and HTML implementation to enhance maintainability. Specifically, I've suggested replacing inline styles with CSS classes and reviewing the use of !important in the custom stylesheet. Overall, this is a great set of enhancements for the project's documentation.

Comment on lines +41 to +53
.highlight {
border-radius: 8px !important;
border: 1px solid rgba(0, 0, 0, 0.05) !important;
transition: box-shadow 0.3s ease;
}

.highlight:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

[data-md-color-scheme="slate"] .highlight {
border-color: rgba(255, 255, 255, 0.05) !important;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of !important on lines 42, 43, and 52 should be avoided if possible. It can lead to maintenance issues by breaking the natural CSS cascade. Consider increasing selector specificity to override the theme's styles. For instance, you might be able to use a selector like .md-content .highlight which could be specific enough to not require !important.

Comment on lines +6 to +16
<div style="display: flex; align-items: center; gap: 20px; margin-top: 1rem; margin-bottom: 1.5rem;">
<div>
<p style="margin: 0; font-size: 1.2rem; font-weight: 500; opacity: 0.9;">
Modern MTProto API Framework for Python
</p>
<div style="margin-top: 12px; display: flex; gap: 8px;">
<a href="https://github.com/5hojib/Electrogram" style="padding: 4px 14px; background: var(--md-primary-fg-color); color: white; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">GitHub</a>
<a href="https://github.com/5hojib/Electrogram/issues" style="padding: 4px 14px; background: #f5f5f5; color: #333; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">Issues</a>
</div>
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This raw HTML block contains a lot of inline styles. To improve maintainability and separate content from presentation, it's better to move these styles into an external stylesheet (custom.css) and use CSS classes on the HTML elements. This will make the styles reusable and easier to manage.

For example, you could add the following classes to your custom.css file:

.intro-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.intro-text {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 500;
  opacity: 0.9;
}

.intro-buttons {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.button-github,
.button-issues {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.button-github {
  background: var(--md-primary-fg-color);
  color: white;
}

.button-issues {
  background: #f5f5f5;
  color: #333;
}
Suggested change
<div style="display: flex; align-items: center; gap: 20px; margin-top: 1rem; margin-bottom: 1.5rem;">
<div>
<p style="margin: 0; font-size: 1.2rem; font-weight: 500; opacity: 0.9;">
Modern MTProto API Framework for Python
</p>
<div style="margin-top: 12px; display: flex; gap: 8px;">
<a href="https://github.com/5hojib/Electrogram" style="padding: 4px 14px; background: var(--md-primary-fg-color); color: white; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">GitHub</a>
<a href="https://github.com/5hojib/Electrogram/issues" style="padding: 4px 14px; background: #f5f5f5; color: #333; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-decoration: none;">Issues</a>
</div>
</div>
</div>
<div class="intro-header">
<div>
<p class="intro-text">
Modern MTProto API Framework for Python
</p>
<div class="intro-buttons">
<a href="https://github.com/5hojib/Electrogram" class="button-github">GitHub</a>
<a href="https://github.com/5hojib/Electrogram/issues" class="button-issues">Issues</a>
</div>
</div>
</div>

@5hojib 5hojib merged commit 644ff51 into beta Feb 11, 2026
1 of 2 checks passed
@5hojib 5hojib deleted the improve-docs-ui-enums-16014549856798480274 branch February 14, 2026 12:31
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