Closed knu closed 1 year ago
@wofr06 That section is inside the if [[ "$fcat" == application && "$ftype" == octet-stream || "$fcat" == text && $ftype == plain ]]
block and thus not reached when a jsx/tsx file is mistaken as text/html. Answering to the second question, HTML files are treated specially in isfinal() and are not passed to a colorizer but to a browser instead.
Place inside less pipe is agreed. For me the output is colored with your patch when using bat/batcat, but colored differently for type js. For other colorizers only js produces colored output. I let you decide whether ftype js is appropriate.
01.10.2023 23:05:13 Akinori MUSHA @.***>:
@wofr06[https://github.com/wofr06] That section is inside the if [[ "$fcat" == application && "$ftype" == octet-stream || "$fcat" == text && $ftype == plain ]] block and thus not reached when a jsx/tsx file is mistaken as text/html. Answering to the second question, HTML files are treated specially in isfinal() and are not passed to a colorizer but to a browser instead.
— Reply to this email directly, view it on GitHub[https://github.com/wofr06/lesspipe/pull/135#issuecomment-1742201504], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADGCKQAAGSJ6NBHKDL3KC2TX5HLIRANCNFSM6AAAAAA5M77SVQ]. You are receiving this because you were mentioned. [Verfolgungsbild][https://github.com/notifications/beacon/ADGCKQCYJORBXXI4LPNBJTTX5HLIRA5CNFSM6AAAAAA5M77SVSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTH27RKA.gif]
You're right, I'm using bat. I think it's mostly "OK" to view a jsx/tsx file colorized as a js file, but it definitely looks nicer when viewing it with bat which has direct support for jsx and tsx.
Why is the code for changing the ftype not placed further below (around line 140 where text only formats are handled)? What is the reason for setting ftype to jsx or jsx-...? Many colorizers recognize the js file type, but not your choices. Would the colorizers do a bad job for setting ftype to js?