You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can tell, get_lexer_by_name() is in fact get_lexer_by_alias(). So if lexer name is not listed under aliases, you won't be able to find such lexer through get_lexer_by_name().
ATM at least lexers/special.py:TextLexer and lexers/special.py:OutputLexer don't have their names present in their aliases.
classTextLexer(Lexer):
""" "Null" lexer, doesn't highlight anything. """name='Text only'aliases= ['text'] # This should be ['text only', 'text'].filenames= ['*.txt']
mimetypes= ['text/plain']
priority=0.01defget_tokens_unprocessed(self, text):
yield0, Text, textdefanalyse_text(text):
returnTextLexer.priority
The text was updated successfully, but these errors were encountered:
Yes, the name get_lexer_by_name() is unfortunately misleading. However, it's not the intent that lexer.name should always be part of lexer.aliases. Basically, the name is meant to be a human-readable language name (esp. for listing at https://pygments.org/languages), and lexer.aliases is for lookup, e.g., in reST/Markdown code blocks.
As far as I can tell,
get_lexer_by_name()
is in factget_lexer_by_alias()
. So if lexer name is not listed under aliases, you won't be able to find such lexer throughget_lexer_by_name()
.ATM at least
lexers/special.py:TextLexer
andlexers/special.py:OutputLexer
don't have their names present in their aliases.The text was updated successfully, but these errors were encountered: