Text
Textual content.
Intended mostly for use for inline text e.g. the text in a paragraph.
Differs from the primitive String
type in that it has a type
and id
property.
The id
property allows use to identify text nodes with a sequence of inline nodes
for better diffing.
Also, in Rust, the value
property is implemented as a CRDT.
Properties
The Text
type has these properties:
Name | Description | Type | Inherited from | JSON-LD @id |
Aliases |
---|---|---|---|---|---|
id |
The identifier for this item. | String |
Entity |
schema:id |
- |
value |
The value of the text content | Cord |
- | schema:value |
- |
Related
The Text
type is related to these types:
- Parents:
Entity
- Children: none
Formats
The Text
type can be encoded (serialized) to, and/or decoded (deserialized) from, these formats:
Format | Encoding | Decoding | Support | Notes |
---|---|---|---|---|
DOM HTML | 🟢 No loss | |||
HTML | 🟢 No loss | Encoded as <span> |
||
JATS | 🟢 No loss | 🟢 No loss | Encoded using special function | |
Markdown | 🟢 No loss | 🟢 No loss | Encoded using implemented function | |
Stencila Markdown | 🟢 No loss | 🟢 No loss | ||
Quarto Markdown | 🟢 No loss | 🟢 No loss | ||
MyST Markdown | 🟢 No loss | 🟢 No loss | ||
LLM Markdown | 🟢 No loss | 🟢 No loss | ||
LaTeX | 🔷 Low loss | 🔷 Low loss | ||
🔷 Low loss | ||||
Plain text | 🟢 No loss | |||
IPYNB | 🔷 Low loss | 🔷 Low loss | ||
Microsoft Word DOCX | 🔷 Low loss | 🔷 Low loss | ||
OpenDocument ODT | 🔷 Low loss | 🔷 Low loss | ||
TeX | 🔷 Low loss | 🔷 Low loss | ||
JSON | 🟢 No loss | 🟢 No loss | ||
JSON+Zip | 🟢 No loss | 🟢 No loss | ||
JSON5 | 🟢 No loss | 🟢 No loss | ||
JSON-LD | 🟢 No loss | 🟢 No loss | ||
CBOR | 🟢 No loss | 🟢 No loss | ||
CBOR+Zstandard | 🟢 No loss | 🟢 No loss | ||
YAML | 🟢 No loss | 🟢 No loss | ||
Lexical JSON | 🔷 Low loss | 🔷 Low loss | ||
Koenig JSON | 🔷 Low loss | 🔷 Low loss | ||
Pandoc AST | 🔷 Low loss | 🔷 Low loss | ||
Directory | ||||
Stencila Web Bundle | ||||
Debug | 🔷 Low loss |
Bindings
The Text
type is represented in:
- JSON-LD
- JSON Schema
- Python class
Text
- Rust struct
Text
- TypeScript class
Text
Testing
During property-based (a.k.a generative) testing, the properties of the Text
type are generated using the following strategies for each complexity level. Any optional properties that are not in this table are set to None
.
Property | Complexity | Description | Strategy |
---|---|---|---|
value |
Min+ | Generate a fixed string of text. | Cord::from("text") |
Low+ | Generate a random string of up to 10 alphanumeric characters. | r"[a-zA-Z0-9]{1,10}".prop_map(Cord::from) |
|
High+ | Generate a random string of up to 100 alphanumeric characters, some special characters commonly used in prose, and whitespace. | r"[a-zA-Z0-9 \t-_.!?*+-/()'<>=]{1,100}".prop_map(Cord::from) |
|
Max | Generate an arbitrary string. | String::arbitrary().prop_map(Cord::from) |
Source
This documentation was generated from Text.yaml
by docs_types.rs
.