Documentation
¶
Overview ¶
Package render turns an agent's Markdown into safe HTML.
Agent output is untrusted: it can be steered by prompt injection. It passes two independent layers before reaching a page. First goldmark with transformers that neutralize raw HTML and images; then a strict bluemonday allow-list. The HTML it returns contains no scripts, styles, event handlers, forms or images, and only http, https and mailto links.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChromaCSS ¶
func ChromaCSS() string
ChromaCSS returns the stylesheet for highlighted code: the "github" style for the light theme and "github-dark" for the dark theme, each scoped to Bootstrap's data-bs-theme attribute. It is committed as assets/static/css/chroma.css; a test fails when the committed file is stale.
Pattern: Classes, Not Styles
Types ¶
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
Markdown renders Markdown to sanitized HTML. It is safe for concurrent use.
func (*Markdown) RenderFinal ¶
RenderFinal is Render for text that will not change again, a finished reply: the result is kept, so the next view of the conversation does not work it out again. Text that is still being written goes through Render, which keeps nothing: every snapshot of it is new.