Skip to content

Prose ​

Renders Markdown as themed, semantic DOM through @vielzeug/scribe: the source is parsed to a frozen AST and built with createTextNode/createElement only, so markup- or script-looking content renders as visible characters — no sanitizer step to forget.

Basic Usage ​

PreviewCode
RTL
html
<ore-prose
  markdown="# Release notes

Ships **today**, with ~~yesterday's~~ bugs fixed. Inline `code` stays crisp.
"
></ore-prose>

Every Refine token drives the typography: headings use the shared heading scale, body text the body scale, and colors the semantic theme. The rendered tree is fully styled inside the component's shadow DOM, so it looks identical wherever it is placed.

Safe by Construction ​

The component inherits scribe's fixed security posture:

  • Raw HTML (<script>, <img onerror=…>) is not part of the Markdown profile: it renders as escaped, inert text.
  • Link and image destinations are policy-checked at parse time — relative URLs, http(s), and mailto pass; javascript: and data: degrade to plain label/alt text.
  • Oversized or pathologically nested sources never crash the view: the component emits error and shows the raw source as plain text.
PreviewCode
RTL
html
<ore-prose markdown="Try it: <script>alert(1)</script> and [click](javascript:alert(1))"></ore-prose>

Streaming Responses ​

Re-rendering replaces the whole tree, so token streaming is just re-assigning the property as chunks arrive:

js
let buffer = '';
for await (const chunk of llmStream) {
  buffer += chunk;
  prose.markdown = buffer; // replaceChildren under the hood; chat-sized documents are cheap
}

Pair with ore-chat-message (streaming attribute) when the prose lives inside a chat bubble: ore-chat-message accepts any content through its default slot, and ore-prose renders it safely.

Tables of Contents ​

Set heading-ids to emit stable slug ids on headings. They match proseOutline from @vielzeug/scribe exactly, so a TOC built from the outline always anchors to the rendered document:

PreviewCode
RTL
html
<ore-prose
  heading-ids
  markdown="## Install

Run the installer.

## Configure

Edit the config."
></ore-prose>

API Reference ​

Attributes ​

AttributeTypeDefaultDescription
markdownstring''Markdown source rendered through scribe
heading-idsbooleanfalseEmit unique slug id attributes on headings

Events ​

EventDetailDescription
error{ error: ScribeError }Fired when the source exceeds a parser limit; raw source shows as text

CSS Custom Properties ​

PropertyDescriptionDefault
--prose-colorBody text colorvar(--text-color-body)
--prose-link-colorLink colorvar(--color-primary)
--prose-code-bgInline code and code block backgroundvar(--color-neutral-backdrop)
--prose-border-colorTable, rule, and quote border colorvar(--color-divider)
--prose-radiusCode block and inline code radiusvar(--rounded-md)

Parts ​

PartDescription
contentThe rendered prose container

Accessibility ​

The rendered tree uses native semantics (h1–h6, ul/ol/li, table, blockquote, a) inside the shadow DOM, which assistive technology traverses like regular light DOM content. Heading levels come from the document itself — keep heading-ids on when a TOC links into the prose so keyboard users can jump. The Markdown profile rejects raw HTML, so an author cannot smuggle ARIA or interactive markup into the document: the only interactive elements a document can produce are links and images.