Skip to content

The parts of a page

By the end of this chapter you can look at a rendered page and name what Glow did to each part of the source — and you know the three places where the rendering parts company with what the same document shows on GitHub.

The lab's specimen is the trail notes from chapter 4, rendered in the dark style and then stripped of its colour codes so it can be printed here:

   Trail Notes for Saturday

  Notes from the walking club's route check, written up for
  anyone leading the walk next month. The path is in good
  shape after the rain, with one flooded section near
  the river gate that needs wellington boots.

  ## The Route at a Glance

  The walk has three legs. Distances were paced out, not
  measured with instruments, so treat them as honest
  estimates rather than survey results.

   Leg               │ From             │ To               │ Distance
  ───────────────────┼──────────────────┼──────────────────┼──────────────────
   1                 │ Village hall     │ River gate       │ 2.1 km
   2                 │ River gate       │ Old mill         │ 3.4 km
   3                 │ Old mill         │ Village hall     │ 1.8 km

  ### Before You Set Off

  [✓] Check the river level notice at the hall
  [✓] Print two spare route cards
  [ ] Charge the group torch
  [ ] Confirm the café stop for lunch

  │ A flooded path is not a challenge to accept. Walk
  │ around, or walk another day — the hill will still
  │ be there.

  ## Recording the Walk

  The club secretary logs each walk with a small script.
  The command she runs is  walklog add saturday , and the
  script itself looks like this:

    #!/usr/bin/env bash
    # Record a finished walk in the club log.
    echo "$(date +%F) $1 $2 km" >> walks.csv

  Full instructions live in the
  club handbook https://example.org/handbook, and
  questions go to the walks coordinator.

  --------

  Notes end. Next route check is the first Saturday of
  next month, weather permitting.

(transcript glow-lab/transcripts/t01-rendering.txt). Now the parts, one at a time.

Colour is escape codes

Nothing on that page is magic. A terminal shows colour and weight because the output contains escape sequences — instructions beginning with the ESC character, of the form ESC[38;5;252m, which means "from here, draw text in colour 252". The lab read the codes off each element; this table is the anatomy of the dark style, measured, not quoted from anywhere:

Element What you see The codes behind it
Body text pale grey 38;5;252
Top heading yellow-ish band, bold 38;5;228 on 48;5;63, bold
## heading blue, bold, marks kept 38;5;39, bold
Bold words same colour, heavier body colour + bold
Inline code soft red on a dark panel, padded 38;5;203 on 48;5;236
Code block indented, tokens coloured, no panel 209 for the #! line, 241 for comments, others per token
Link text bold green 38;5;35, bold
Link address teal, underlined 38;5;30, underlined
Rule (---) eight grey dashes 38;5;240

Two consequences follow. First, the coloured rendering of the trail notes is 36,138 bytes for a 1,390-byte document — twenty-six times the source — because the style restates colours around nearly every word and space. Colour is bulky. Second, any guide (including this one) that quotes Glow's output has silently stripped those codes away; the lab's stripper is glow-lab/render.sh. What you see above is the page with its colour removed, which is the only honest way to print it on paper — and why copying a rendering off a screen into a file is a way to contaminate the file (the rule from chapter 1).

Headings: one rule for the top, another below

The top-level heading loses its # and becomes a band: bold text on a coloured background, padded with a space at each end. Every heading below it keeps its marks — the style definition literally prefixes ##, ###, #### — and takes its colour and boldness to do the work of looking like a heading. On GitHub, by contrast, all headings lose their marks. Neither is wrong; they are different readings, and the first time you meet ## in a Glow page it helps to know the marks are meant to be there.

Code, tables, lists, quotes

  • A fenced code block is indented and syntax-coloured, but sits on no panel — the colours alone set it apart. A fence with no language named is printed plain and indented. Inline code gets the panel instead: a dark background and a space of padding at each end (in the stripped page above, that padding is the odd spacing around walklog add saturday).
  • A table is drawn with Unicode line characters — │, ─, ┼ — and padded columns. The header row is plain body colour; the ruled line under it does the separating. In the plain notty style the same table is drawn with ASCII | and -.
  • A task list shows [✓] for a ticked box and [ ] for an open one in the colour styles; notty keeps the source's own [x] and [].
  • A block quote gets a │ bar down its left edge (| in notty).
  • A numbered list keeps its numbers; a nested bullet becomes a •, indented two spaces per level (the lab's kitchen-sink.md is the specimen; transcript glow-lab/transcripts/t08-tui.txt shows it in the built-in pager).
  • Struck-through text is drawn struck through, and raw HTML inside a document is reduced to its text — the tags are dropped, the words kept.

A terminal cannot open a link, so Glow prints the text, then the address: "club handbook https://example.org/handbook". It also wraps the pair in an OSC 8 hyperlink sequence, the newer escape that tells a capable terminal "this text is clickable" — terminals that understand it make the link a real link; the rest show the text and address as printed. The OSC 8 codes are emitted even by the plain notty style: the lab counted exactly 4 ESC bytes in the whole notty rendering of the trail notes, and all four belong to OSC 8 sequences. "Plain", it turns out, means almost plain.

An image becomes one line of text:

  Image: A red bicycle leaning on a fence → /home/…/fixtures/bicycle.png

The alt text, an arrow, and the image's absolute path — resolved against the document's folder, and printed whether or not the file exists; Glow does not check (transcript glow-lab/transcripts/t09-sources.txt). As a reading compromise this is defensible — you learn what the image was meant to show and where it lives — but it is the rule again: if seeing the photograph is the point, you need the browser (chapter 13).

Where the reading parts company with GitHub

Three differences are worth naming plainly, because documents move between the two:

  1. Headings keep their marks below the top level, as covered above. GitHub's do not.
  2. Footnotes are not rendered. A [^1] reference stays on the page as the literal characters [^1], and the footnote's text is printed as an ordinary paragraph where it was defined. Nothing connects them. The lab's kitchen-sink.md carries a footnote precisely so this is provable, and chapter 14 counts it as a limit, not a quirk.
  3. Newlines inside a paragraph are kept. Where a web renderer folds a single line break into a space, Glow shows the break. Chapter 9 covers the -n flag, which claims to govern exactly this — and reports that it changed nothing the lab could measure.

Check: render a document of yours with a footnote and an image in it, in Glow and on GitHub or in a browser. Name the three differences before looking back. If you can, you can read a Glow page for what it is.