LanguageValues and typesStandard typesText formats
RichTextSpan
On this page
A run of text in a block, with its marks and any link.
Use it when you build a RichTextBlock in code.
Shape
| Field | Type | Required? |
|---|---|---|
text |
Text |
Yes |
marks |
List<RichTextMark> |
Yes |
link |
Text |
No |
Write every field when you build one, and give a field that isn't required as none.
Example
RichTextSpan { text: "today's soup" marks: [RichTextMark.strong] link: none }Good to know
- It can't be empty. A link must be
https:with a host, ormailto:. ==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"text":"Soup","marks":[]}{"text":"today's soup","marks":["strong","emphasis"]}{"text":"our site","marks":[],"link":"https://example.com/soups?day=mon#leek"}
When you read one, a field that isn't required may be left out, or sent as null.
Details
Text form, storage, how it is shown, and operations
RichTextSpan 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 3 columns, each named for the field, _ and its suffix. This is {"text":"our site","marks":[],"link":"https://example.com/soups?day=mon#leek"}:
| Column | Type | Holds |
|---|---|---|
<field>_text |
text |
'our site' |
<field>_marks |
text[] |
'{}'::text[] |
<field>_link |
text |
'https://example.com/soups?day=mon#leek' |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"text":"Soup","marks":[]} |
Soup |
{"text":"today's soup","marks":["strong","emphasis"]} |
today's soup |
{"text":"our site","marks":[],"link":"https://example.com/soups?day=mon#leek"} |
our site |
{"text":"write to us","marks":["underline"],"link":"mailto:soup@example.com"} |
write to us |
Operations
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-span.md.Built from Jadpo main at aee2e8f.