Skip to content
Anjunar/ DOCS

Rich text

Paragraphs, headings, quotations and inline marks share one immutable document.

Concept

Blocks and marks

A block describes structure; a mark describes a text run. Selecting text and toggling a mark can split runs without changing the surrounding paragraph.

Format this text

Select words, apply bold or italic, then turn a paragraph into a heading or quote.

Rich text

Select this important sentence and change its formatting.

A second paragraph can become a heading.

17 words · 9 nodes
# Rich text Select this **important sentence** and change its formatting. A second paragraph can become a heading.
Source

Typed editing commands

The same commands drive keyboard shortcuts and toolbar buttons. SetHeading(None) returns to a paragraph.

scala
session.dispatch(RichText.ToggleMark, StandardMarks.Strong) session.dispatch(RichText.ToggleMark, StandardMarks.Emphasis) session.dispatch(RichText.SetHeading, Some(HeadingLevel.H2)) session.dispatch(RichText.SetHeading, None) session.dispatch(RichText.Quote)