mirror of
https://github.com/jbranchaud/til
synced 2026-01-08 01:28:02 +00:00
Add Specify The Language For A File With Bat
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||||
|
|
||||||
_791 TILs and counting..._
|
_792 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -744,6 +744,7 @@ _791 TILs and counting..._
|
|||||||
- [Show The Size Of Everything In A Directory](unix/show-the-size-of-everything-in-a-directory.md)
|
- [Show The Size Of Everything In A Directory](unix/show-the-size-of-everything-in-a-directory.md)
|
||||||
- [SSH Escape Sequences](unix/ssh-escape-sequences.md)
|
- [SSH Escape Sequences](unix/ssh-escape-sequences.md)
|
||||||
- [SSH With Port Forwarding](unix/ssh-with-port-forwarding.md)
|
- [SSH With Port Forwarding](unix/ssh-with-port-forwarding.md)
|
||||||
|
- [Specify The Language For A File With Bat](unix/specify-the-language-for-a-file-with-bat.md)
|
||||||
- [Sort In Numerical Order](unix/sort-in-numerical-order.md)
|
- [Sort In Numerical Order](unix/sort-in-numerical-order.md)
|
||||||
- [Switch Versions of a Brew Formula](unix/switch-versions-of-a-brew-formula.md)
|
- [Switch Versions of a Brew Formula](unix/switch-versions-of-a-brew-formula.md)
|
||||||
- [Touch Access And Modify Times Individually](unix/touch-access-and-modify-times-individually.md)
|
- [Touch Access And Modify Times Individually](unix/touch-access-and-modify-times-individually.md)
|
||||||
|
|||||||
18
unix/specify-the-language-for-a-file-with-bat.md
Normal file
18
unix/specify-the-language-for-a-file-with-bat.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Specify The Language For A File With Bat
|
||||||
|
|
||||||
|
The `bat` utility is able to correctly infer the language of most files it
|
||||||
|
prints based on the file extension. In some cases, you may want to specify a
|
||||||
|
language other than the one it guesses.
|
||||||
|
|
||||||
|
For instance, here is a React file printed with `bat`:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The `jsx` syntax doesn't look great because of the inferred language
|
||||||
|
highlighting doesn't account for it. We can get better results by telling
|
||||||
|
`bat` that the file should be parsed as `JavaScript (Babel)`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
By including `--language=jsx` as a flag, `bat` uses a different language
|
||||||
|
parser and the output is now what I'm looking for.
|
||||||
Reference in New Issue
Block a user