Your first read
By the end of this chapter you have
read the same document three ways —
printed straight, handed to a pager,
opened in Glow's own pager — and can
say what each way is for. Everything
here uses one specimen, the lab's
trail-notes.md: a walking club's
route notes with a heading or three, a
table of distances, a task list, a
quoted warning, a few lines of code,
and a link. Your own README will do
just as well.
Way one: printed straight
glow trail-notes.md
On a terminal, Glow prints the
rendered page and exits, like cat
with the page already made up. You
see the top heading as a coloured
band with no # in sight, the table
drawn with ruled lines, the ticked
tasks marked [✓], the code block
indented and coloured. Chapter 5 takes
this page apart piece by piece; for
now, notice the shape: margins, blank
lines between sections, text wrapped
at 80 columns even if your terminal
is wider.
Way two: handed to a pager
glow -p trail-notes.md
The -p flag hands the page to a
pager — by default less — so you
can scroll, search with /, and quit
with q, instead of the page washing
up your screen. The rendering the
pager receives is the same coloured
one; chapter 7 examines the handover
closely, because it works even in
places you might not expect.
Way three: Glow's own pager
glow -t trail-notes.md
The -t flag opens the document in
Glow's built-in full-screen pager: a
header naming the file, a footer
showing how far through it you are,
the page rendered at your window's
width rather than 80. This is the
same pager the file browser uses
(chapter 11), and it is the one
interactive face of Glow most readers
will meet.
A note on what "on a terminal" means in this guide. Glow behaves differently when its output is a terminal and when it is not — the next chapter is built on that. When this guide shows output, it says which of the two it was, and the lab's transcripts record it the same way.
The same command, into a pipe
Run the first way again with the output captured:
glow trail-notes.md | wc -c
The lab counted 3,899 bytes for a
1,390-byte document — bigger than the
source, because a rendering adds
spacing and drawn table lines — but
with no colour in it at all: in a
pipe, the auto style falls back to
the plain notty style, byte for
byte the same output as asking for it
by name (transcript
glow-lab/transcripts/t01-rendering.txt).
That fallback is Glow being polite to
whatever receives the pipe. Chapter 6
shows what happens if you override
it, and it is less polite.
Check: read one of your own Markdown files all three ways. Say which way you would use for a two-page README, and which for a sixty-page manual. If you can, you have this chapter.