glow
glow copied to clipboard
Garbled output with -p and most
I want to read a markdown file pager-style, not by scrolling in the shell. So I use -p
; most
is my pager. Compare:
glow -p README.md
:
glow README.md
:
glow README.md | most
Workaround: glow .
or glow --all
and select the file.
Not sure whether the problem is actually with glow, not most (most does show colors in other cases, e.g. when showing man pages). So I guess I'll spin this as a feature request: please add an option (that I can make the default through the config file) that opens the given file in "pager mode" directly (without the external pager).
❯ glow --version
glow version 1.4.1 (4863f57)
❯ most --version
MOST version 5.0.0 (S-Lang version 2.3.2)
*Note: This executable was compiled against S-Lang 2.3.1
Pretty sure these are ansi codes that your pager is not configured to recognize. Search the internet or the less docs for the less -r and see if there's an equivalent flag for most
I was only looking for color (which are turned on automatically for most
); searching for "control characters", -v
might help. But how do I test that? I don't see a way to pass pager flags t glow
; it'd have to add the option automatically on -p
the way it does for less
, wouldn't it?
I'd still rather go to glow's "pager" directly, anyway, instead of printing to the shell. Should I open a separate ticket for that?
You can set the flags in less in their env's or you can also pipe to glow with glow -
. As in cat README.md | glow -
I don't think I've made myself understood. Let me try again.
- I use
most
, notless
. - I don't actually want to use glow with
most
, or any pager. - What I want is pager-style Markdown viewing.
glow
can do that -- but doesn't when I call it with a file (or stdin, for that matter). I have to open the directory in glow, then select the file. -
glow -p
, my last resort, doesn't work withmost
.
The last item -- the actual concern of the OP -- might be fixed by adding one flag or another to the call to most
in glow (see also #250), or to change the output in a compatible way (depending on the pager?).
I checked the man page of most
; there actually is MOST_SWITCHES
but none of the available options helps.
The actual issue would be addressed by changing glow
so that there's way to directly get to the result as described in the workaround in the second-to-last item.
What I did: set MANPAGER
to most
(so now only man uses most) and PAGER
to less -r
(which apparently is the default used by glow if pager is unset. You could also unset PAGER
to have the same effect).
Not really a solution, but it should get you up and running at least...
I think this may just be a most
version that doesn't support RGB colors yet - the most recent releases do however.
As such, I can't reproduce this issue anymore, but here are a few tips:
-
if you unset your
COLORTERM
environment variable toyes
ortrue
, glow should default to rendering ANSI256 colors, which your version ofmost
should understand. In such cases setting thePAGER
tomost
works fine. -
piping glow's output to other programs will disable styles and color rendering, as it detects not being connected to a terminal. You can override this by setting
CLICOLOR_FORCE
totrue
.