PROPHET/OS

NAME

pmd: reads a text in markdown on the terminal, instead of showing its marks

SYNOPSIS

pmd [--tui] <file>...

DESCRIPTION

Reads a text in markdown on the terminal, instead of showing its marks.

The tree writes its texts in markdown: every manual page under /system/man, every document under docs. Whoever read one until now read the marks as well, the stars and the backticks in his face. This program reads them for him: a heading stands bright, code stands in cyan, a strong word stands out, a list gets a bullet, a rule gets a line, and a link shows its text with the address plainly behind it.

**No markup reaches the reader.** Whatever stands in the text, what comes out are words: headings of all six levels, the two ways to write one, emphasis strong and light, struck through, code inline and in a fenced block, lists flat and nested, tasks open and done, quotes however deep, tables with their alignment, footnotes, images, links by address and by label, and the character behind a backslash.

Without a name it reads what comes in over the pipe, so cat x.md | md works and so does grep -A 3 word x.md | md.

Lines are wrapped at the width of the console, at a space and never in the middle of a word, and a wrapped line keeps the indent of the one it came from.

Prophet Markdown

A text says with one line that it uses the marks of our own:

It stands in an html comment, so it shows nothing here and nothing in a foreign reader either, and without it a text is read as plain markdown. A file that leaves this tree therefore behaves out there exactly as it does here.

The right edge

One mark is our own, because markdown has none for it:

Page 1 >| 2026-10-04

What stands behind >| goes to the **right edge** of the line. That is what a head line is, a word left and a date right, and markdown offers only a table with borders for it or two spaces that mean nothing.

**No width has to be given, and no side gets a share.** The left half is as wide as it is, the right half is as wide as it is, and the room between them is the remainder. Nothing is squeezed and nothing is cut.

A decision happens only when the two together do not fit on the line -- on a narrow console, or because the text grew -- and it is not "who gets more": the right half goes **under** the line with -> in front of it, at the column it would have stood at.

A left half that fills the line all by itself
                                  -> 2026-10-04

Several marked lines under each other are one block, and the writer measures it: their right halves all start at the same column, the width minus the widest right half of the block. So a column comes out without anybody counting.

Whoever wants his own column says so:

Mem  >|40 what the machine holds
Comp >|40 what the compression saves
Heap >|60% how full the kernel heap is

A number is that column, a number with a percent sign is that part of the width, for a text that is read at eighty columns and at two hundred.

The mark needs a space in front of it, holds once per line, and inside code it is the characters that stand there.

In a frame

pmd --tui <file> shows the page in a frame, with a tab per chapter (every heading of the first two levels) and a line at the bottom that says where one stands. The keys, and this block is the mark of the right edge at work:

up, down >| one line page up, page down >| one screen home, end >| the ends of the text tab, left, right >| the next chapter q >| quits

The work stands in lib/os/mdview.c over lib/text/markdown.c, and man shows its pages the same way: one answer to one question, in one place.

EXAMPLE

$ pmd --help
pmd [--tui] <file>...
  a text in markdown, read on the terminal
  --tui: in a frame, with a tab per chapter and keys to scroll
  without a name: what comes in over the pipe

SEE ALSO

man, cat, more