broot icon indicating copy to clipboard operation
broot copied to clipboard

transformer mode to pass raw text (colored) to preview

Open knirch opened this issue 6 months ago • 2 comments

Use case; I have some binary files which I'd like to pretty print some details around, but forcing color output makes broot treat it as binary, so I'm "stuck" with monochromatic previews for those. It would be nice if there was a "ansi/color/asis/raw" type of mode one could use. (maybe that's suitable for those wanting alternative syntax highlighters too? https://github.com/Canop/broot/issues/587#issuecomment-1483716194 https://github.com/Canop/broot/issues/587#issuecomment-2395118489 https://github.com/Canop/broot/issues/318#issuecomment-2053961854 https://github.com/Canop/broot/issues/297 )

Not sure if feasible, as I doubt you'd want to add something that'll break regular features of the preview pane.

But it does seem like (not fluent in rust, so I only did a cursory glance) you have a "per line" processing of the colored output from syntactic so you can do line filtering. If not, then I understand perfectly if you wouldn't want to entertain this request.

That said, for now I'll just use an output_extension that manages to look good enough :)

knirch avatar Jun 13 '25 09:06 knirch

Are you speaking of ANSI escape codes ?

To make that more concrete and ease tests, can you please send me one of those files ?

Canop avatar Jun 13 '25 09:06 Canop

To onlookers: it was discussed on Miaou. I'll try to see how to optionnally render code with ANSI escape code in the preview

Canop avatar Jun 13 '25 12:06 Canop

@knirch Can you have a look at https://github.com/Canop/broot/pull/1025 ?

Canop avatar Jun 23 '25 16:06 Canop