Formatted text
What people and agents write, drawn with a small, safe set of Markdown marks: strong, emphasis, struck, code, quotes, lists and links.
import { FormattedText, parseFormatted, formattedPreview } from "@arcadia/ui"TSX
Examples
Marks
WrittenDrawn**strong***emphasis*~~struck~~`code`**strong with *emphasis* inside**\*a backslash keeps a mark\*snake_case and __init__ stay whole2*3*4 and file*name*s stay as typedA line
and the next- a bullet
- another, long enough to wrap onto a second line under its own text
- one level in1. first
2. second9. ninth
10. tenth> A quote, one level```ts
const answer = 42;
```
Labelled links
WrittenDrawnRead [the release notes](https://github.com/acme/app/releases) before you update.[google.com](https://evil.example/sign-in)[the [beta] notes](https://www.example.com/beta)[https://example.com](https://example.org/elsewhere)[open](javascript:alert(1))[the notes](https://example.com/notes
The rest of Markdown
WrittenDrawn## A heading| check | runs |
|-------|-----:|
| lint | 12 |
| test | 340 |<b>bold</b> <script>alert(1)</script>---- [ ] a task boxA footnote[^1]
[^1]: the note
Addresses
WrittenDrawnhttps://example.comhttp://example.org/a?b=1(see https://example.com/docs/setup).The steps are in the guide (https://example.com/docs/runners/setup-the-new-runner) and in the log.https://example.com/reports/builds/runner-seven/logs/install-step/attempt-three?view=full&lines=all#first-failurehttps://exаmple.com/sign-inhttps://[email protected]/
On a server
TSX
FormattedText
sourcerequired- string
- The text as written: plain text, read for a small set of Markdown marks. Nothing else decides its look.
ranges- readonly FormattedTextRange[]
- Spans of the source the product has already understood (
startandlengthin UTF-16 units), each drawn as itsnode. A range is never read for marks, though a mark may run across it; inside code it is text. One that overlaps another, runs outside the source or crosses a line is dropped. end- ReactNode
- A small mark that ends the last line (a read mark, a time): after the last word,
--space-1on, in the text's own style at its regular weight, so an icon in it takes the line's pair. It goes to a new line only with that word, never alone, and a copy leaves it out. After a closing block of code it stands under the block, at its end. rootStyle- RootStyle
- Typed StyleX override: where the text sits (layout only).
Rest props go to <div> props.