-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Syntax.guess_lexer
, add support for more lexers (e.g. Django templates etc.)
#1869
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1869 +/- ##
==========================================
- Coverage 99.82% 99.58% -0.24%
==========================================
Files 71 71
Lines 6943 7028 +85
==========================================
+ Hits 6931 6999 +68
- Misses 12 29 +17
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
11.1.0 - 2022-01-28 Added Add Syntax.guess_lexer, add support for more lexers (e.g. Django templates etc.) Textualize/rich#1869 Add lexer parameter to Syntax.from_path to allow for overrides Textualize/rich#1873 Fixed Workaround for edge case of object from Faiss with no __class__ Textualize/rich#1838 Ensure Syntax always justifies left Textualize/rich#1872 Handle classes in inspect when methods=True Textualize/rich#1874
Type of changes
Checklist
Description
The code which determines which lexer to use was always using filename. If you gave it a file with
.html
extension, it'd use the HTML lexer. This means that if you used e.g. a Django template with a file extension of.html
, it would just use the HTML lexer, and not the Django one.This change ensures we take advantage of the analysis Pygments can perform to select the most appropriate lexer in cases like this.