Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 5 Nov 2026. What's built · Install 0.3.0
jadpo
ReferenceText formats

LanguageValues and typesStandard typesText formats

RichText

On this page

A structured document: a list of paragraphs, headings, quotes and list items.

Use it to hold content from a block editor. markup.rich_to_html gives Html. For text someone types by hand, use Markdown.

Shape

A list of RichTextBlock.

Example

example
var example: RichText = [    RichTextBlock.paragraph {        spans: [            RichTextSpan { text: "Fresh soup" marks: [] link: none }        ]    }]assert example == example

Good to know

  • It is flat: nothing nests inside anything else.
  • == tells you whether two are the same. < and list.sort_by don't take it.

In JSON

An array of its items, in a request, a response or json.write:

json
[{"tag":"heading","level":2,"spans":[{"text":"Soups","marks":[]}]},{"tag":"paragraph","spans":[{"text":"Made ","marks":[]},{"text":"daily","marks":["strong"]}]}][{"tag":"bullet_item","level":1,"spans":[{"text":"Leek","marks":[]}]},{"tag":"bullet_item","level":1,"spans":[{"text":"Tomato","marks":[]}]}][]

Details

Text form, storage, how it is shown, and operations

RichText is in the group Text formats, and has been in Jadpo since 0.1.0.

Text form

It has no single text form, so text.from and text.parse don't take it.

How it is stored

It is stored in one column named for the field, of type jsonb. [{"tag":"bullet_item","level":1,"spans":[{"text":"Leek","marks":[]}]},{"tag":"bullet_item","level":1,"spans":[{"text":"Tomato","marks":[]}]}] is stored as '[{"tag":"bullet_item","level":1,"spans":[{"text":"Leek","marks":[]}]},{"tag":"bullet_item","level":1,"spans":[{"text":"Tomato","marks":[]}]}]'::jsonb.

How it is shown to people

text.format(value, locale:) shows it to people in their locale.

With locale: Locale.en_gb:

Value Shown
[{"tag":"heading","level":2,"spans":[{"text":"Soups","marks":[]}]},{"tag":"paragraph","spans":[{"text":"Made ","marks":[]},{"text":"daily","marks":["strong"]}]}] "Soups\nMade daily"
[{"tag":"bullet_item","level":1,"spans":[{"text":"Leek","marks":[]}]},{"tag":"bullet_item","level":1,"spans":[{"text":"Tomato","marks":[]}]}] "Leek\nTomato"
[] ""

Operations

  • markup.rich_to_html(rich: RichText) -> Html: rich written as HTML, each block its element and each mark its element inside its link, then made safe as every Html is, which changes nothing: a RichText holds only what the sanitiser keeps.

It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.

Markdown for agents: /docs/types/type-rich-text.md.Built from Jadpo main at aee2e8f.