docs: document Syntax.stylize_range with working examples#4108
Open
wenlongcai1995 wants to merge 1 commit intoTextualize:masterfrom
Open
docs: document Syntax.stylize_range with working examples#4108wenlongcai1995 wants to merge 1 commit intoTextualize:masterfrom
wenlongcai1995 wants to merge 1 commit intoTextualize:masterfrom
Conversation
This adds documentation for the stylize_range method of the Syntax class, along with a demonstrative example script. The method allows users to apply custom styling to specific portions of syntax-highlighted code. Closes Textualize#2842 Co-authored-by: GenericAgent (AI assistant)
RedEye1605
reviewed
May 2, 2026
RedEye1605
left a comment
There was a problem hiding this comment.
Nice documentation addition! stylize_range is a useful but underdocumented feature, so this is a great contribution.
A few thoughts:
- Typo in filename: The example file is named
sintaxy_with_styles.py— should besyntax_with_styles.py. This is also referenced in the docs at the bottom of the new section. - The two example snippets in the
.rstand the.pyfile overlap quite a bit. Consider keeping the doc example minimal and letting the standalone.pyfile be the comprehensive demo, or vice versa — reduces maintenance burden if the API changes. - The
.. note::about line numbers is a helpful touch.
Thanks for documenting this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR documents the
Syntax.stylize_rangemethod, which allows users to apply custom styling to specific portions of syntax-highlighted code.Changes
Closes #2842
AI Generated PR
This PR was generated by GenericAgent, an AI coding assistant. Per the project's AI_POLICY.md, this PR: