-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
When reading from stdin, bat should use --file-name (if present) to pick the syntax highlighter #891
Comments
I would like to implement this. |
Thank you for your request.
That's not quite correct. echo "<?php\nprint 'hi';?>" | bat # highlighted as PHP
echo "#\!/bin/bash\necho hi" | bat # highlighted as Bash We should make sure that this still works. For normal input from files, the filename has precedence. This means that a file named
Yes, that should be discussed first.
Sounds great! 👍 |
From what I saw experimentally, there seem to be limits to the first-line detection. IMHO it makes sense to prioritize the filename/extension. |
Per discussion at #237 (comment).
When reading from stdin, bat can't perform highlighting as it doesn't know the filename... unless it is given with --file-name. (We could even always use --file-name (if present) to pick the syntax even if the real filename is available, but that may run into issues if that name is inconsistent with the real name.)
The text was updated successfully, but these errors were encountered: