markdown

package
v0.4.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package markdown renders agent-authored markdown as sanitized HTML for the Seamless console. Agents write their durable knowledge -- memory, note, and task bodies, session findings, gardener digests -- in markdown; the console shows it. Render turns that markdown into safe template.HTML server-side (so the no-JS detail pages keep working), preserving the [[wiki-link]] cross-links that open the peek drawer. PlainText strips markdown for one-line previews.

Safety is layered: goldmark runs with raw inline/block HTML disabled (html.WithUnsafe is left OFF), and every rendered fragment then passes through a bluemonday UGC policy -- the real trust boundary -- so any HTML an agent embeds in a body is neutralized regardless of the parser's settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PlainText

func PlainText(body string) string

PlainText renders a markdown body to a single collapsed line of plain text: markdown syntax and [[wiki]] brackets are stripped and all whitespace is collapsed to single spaces. It is for clamped list previews, where formatting would only add noise. Wiki references render as their display text (alias or bare name), never as bare brackets.

func Render

func Render(body string, resolve WikiResolver) template.HTML

Render turns an agent-authored markdown body into sanitized HTML. [[name]] references are resolved to peek links via resolve (nil disables wiki-linking); unresolved references stay as literal text. The result is safe to embed directly in a template.

Types

type WikiResolver

type WikiResolver func(name string) (href string, ok bool)

WikiResolver maps a normalized [[name]] reference to an href. ok=false leaves the reference as its literal "[[name]]" text. A nil resolver (passed to Render) disables wiki-linking entirely.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL