377c616a
web: render memory bodies as markdown, and resolve their references
A memory's value is markdown and always was: `bd remember` stores what was
typed, and what is typed is the same prose the memory files carry — bold
leaders, code spans, fenced recipes, and [[slug]] references to related
memories. The view printed it as pre-wrapped paragraphs, which shows the
source rather than the document and leaves every reference a dead end.
The renderer is web/markdown.go, one shared goldmark with three departures
from stock:
- [[slug]] is an inline parser rather than a text rewrite, so a reference
written inside a code span stays text by construction.
- Raw HTML is escaped and shown, not dropped. The safe default omits it,
and these memories are full of <placeholder> spellings CommonMark reads
as tags; omitting one rewrites SRHT_<NAME>_VER to SRHT__VER silently,
which is worse than showing markup.
- An image renders as a link. An <img> at another host is a request that
host makes on behalf of whoever opened the page.
References resolve across databases, because that is where they point: the
mirroring workflow files a memory by its type, so a related memory is as
likely to be in another tracker as in this one. The index is the one the
issue links already use — issue_prefix and the kv.memory.* keys are rows of
the same config table, so one read per database now answers both questions
and one cached projection carries both. A slug two trackers hold resolves to
the first listed, the page's own database, unlike a prefix two trackers claim
which resolves to neither: the same slug in two trackers is normally one
memory that was re-filed and left a copy behind.
A slug nobody wrote and a slug held by a database the caller may not browse
are one rendering — a muted, inert marker. A link, a distinct class or a
different tooltip would each publish the existence of a private database.
Memory.Paragraphs goes with the paragraphs it existed for.
Eugene Blikh <bigbes@gmail.com> — 2026-08-15 12:25:19 UTC
Commit 377c616a8a3b385f18a8d6509c7a6be3a31af2bd —
view raw patch
Parent(s):
bd2d8a36
| File | Status | + | − |
|---|---|---|---|
beads/memory.go
|
M | +8 | -29 |
beads/memory_test.go
|
M | +3 | -3 |
beads/prefixes.go
|
M | +113 | -39 |
beads/prefixes_test.go
|
M | +124 | |
docs/DESIGN.views.md
|
M | +36 | -1 |
go.mod
|
M | +1 | |
go.sum
|
M | +2 | |
web/beads.go
|
M | +47 | -28 |
web/handlers_view.go
|
M | +8 | |
web/markdown.go
|
A | +385 | |
web/markdown_test.go
|
A | +282 | |
web/memory.go
|
M | +51 | -1 |
web/templates/memory.html
|
M | +61 | -7 |