Package-level declarations

Types

Link copied to clipboard

A category interface for paragraph attributes that control the alignment of its contents. Only one Alignment attribute can be active in a given paragraph.

Link copied to clipboard

An immutable container that holds attribute keys and their values in a type-safe manner.

Link copied to clipboard

A builder DSL for safely mutating multiple text attributes within a specific range.

Link copied to clipboard
sealed interface AttributeKey<T>

Interface defining a key for attributes held within RichText. By having a type-safe defaultValue, it clearly defines the fallback value when an attribute is not set.

Link copied to clipboard

The standard AttributeKey to denote the background color. Contains a RgbaColor when specified, or RgbaColor.Unspecified otherwise.

Link copied to clipboard

A semantic marker indicating that the paragraph is a blockquote.

Link copied to clipboard

A category interface for paragraph attributes that dictate block structure (e.g., Heading, List, Blockquote). Only one BlockType attribute can be active in a given paragraph.

Link copied to clipboard

The standard AttributeKey to denote bold text.

Link copied to clipboard
data class BulletListItem(val textIndex: Int, val indentLevel: ListIndentLevel, val color: RgbaColor?) : ListItem

Represents a bullet list item.

Link copied to clipboard

A semantic marker indicating that the paragraph is a bullet list item.

Link copied to clipboard
data class DiscoveredUrl(val range: IntRange, val rawUrl: String, val url: String)

Represents a URL discovered within a text sequence.

Link copied to clipboard
data class EnterKeyContext(val text: String, val cursorPosition: Int, val paragraphRange: IntRange, val currentAttributes: AttributeContainer)

Provides the context necessary for an EnterKeyStrategy to make a decision.

Link copied to clipboard
sealed interface EnterKeyResult

Represents the outcome of an EnterKeyStrategy execution.

Link copied to clipboard

Defines the strategy for how a paragraph should handle an Enter key press (newline insertion). This strategy determines the attributes of the newly created paragraph or modifies the current paragraph's attributes.

Link copied to clipboard

The standard AttributeKey to denote the font size. Contains a TextSize when specified, or TextSize.Unspecified otherwise.

Link copied to clipboard

A strategy for headings. When an Enter key is pressed within or at the end of a heading, the newly created paragraph will be a standard paragraph without the heading attribute.

Link copied to clipboard

A semantic marker indicating the heading level of the paragraph.

Link copied to clipboard

Represents heading semantic levels.

Link copied to clipboard

A strategy that inherits the current paragraph's attributes for the new paragraph. This is the default behavior for standard paragraphs and alignment attributes.

Link copied to clipboard

The standard AttributeKey to denote inline code text.

Link copied to clipboard
@RequiresOptIn(message = "This API is internal to Arranger and should not be used outside of it.", level = RequiresOptIn.Level.ERROR)
annotation class InternalArrangerApi
Link copied to clipboard

The standard AttributeKey to denote italic text.

Link copied to clipboard

The standard AttributeKey to denote a hyperlink URL.

Link copied to clipboard

A strategy for list items. Handles nested lists by outdenting when an empty list item is entered.

Link copied to clipboard

Represents the indent level of a list item.

Link copied to clipboard
sealed interface ListItem

Represents the semantic structure of a list item within a RichString.

Link copied to clipboard
data class OrderedListItem(val textIndex: Int, val indentLevel: ListIndentLevel, val color: RgbaColor?, val index: Int) : ListItem

Represents an ordered list item (e.g., 1. 2. 3.).

Link copied to clipboard

A semantic marker indicating that the paragraph is an ordered list item.

Link copied to clipboard
sealed interface ParagraphAttributeKey<T> : AttributeKey<T>

A marker interface indicating that the attribute applies to whole paragraphs.

Link copied to clipboard
value class RgbaColor(val value: Long)

Represents a color using a 64-bit ULong to keep the model platform-independent. It perfectly aligns with Compose's Color representation or an ARGB bitmask.

Link copied to clipboard
data class RichRun<T>(val text: String, val range: IntRange, val value: T)

Represents a contiguous block of text where a specific attribute is continuously applied.

Link copied to clipboard
data class RichSpan(val range: IntRange, val attributes: AttributeContainer)

Represents a span of attributes applied to a specific range within a RichString.

Link copied to clipboard
data class RichString(val text: String, val spans: List<RichSpan> = emptyList())

An immutable rich text representation that pairs plain text with type-safe attributes applied to specific character ranges.

Link copied to clipboard
class RichStringScope(currentSpans: List<RichSpan>, text: String)

A DSL scope used to safely mutate the attributes of a RichString within an edit block. All mutations are accumulated internally and used to produce a completely new, immutable RichString instance when the block completes.

Link copied to clipboard
interface RichTextExporter<T>

An interface for exporting a RichString into a specific representation of type T.

Link copied to clipboard

A bi-directional format that can both export a RichString to type T and import type T into a RichString.

Link copied to clipboard
interface RichTextImporter<T>

An interface for importing data of type T into a RichString.

Link copied to clipboard

A marker interface indicating that the attribute applies to character spans.

Link copied to clipboard

The standard AttributeKey to denote strikethrough text.

Link copied to clipboard

Represents horizontal text alignment within a paragraph.

Link copied to clipboard

A semantic marker indicating the horizontal text alignment of the paragraph.

Link copied to clipboard

The standard AttributeKey to denote the foreground text color. Contains a RgbaColor when specified, or RgbaColor.Unspecified otherwise.

Link copied to clipboard
value class TextSize(val sp: Float)

Represents a text size in scaled pixels (sp) without depending on Compose.

Link copied to clipboard

The standard AttributeKey to denote underlined text.

Link copied to clipboard
object UrlParser

Utility object to parse URLs from text.

Functions

Link copied to clipboard

Returns an empty AttributeContainer.

fun <T> attributeContainerOf(p1: <Error class: unknown class><AttributeKey<T>, T>): AttributeContainer

Returns a new AttributeContainer containing the specified key-value p1.

fun attributeContainerOf(vararg pairs: <Error class: unknown class><AttributeKey<*>, Any?>): AttributeContainer
fun <T1, T2> attributeContainerOf(p1: <Error class: unknown class><AttributeKey<T1>, T1>, p2: <Error class: unknown class><AttributeKey<T2>, T2>): AttributeContainer
fun <T1, T2, T3> attributeContainerOf(p1: <Error class: unknown class><AttributeKey<T1>, T1>, p2: <Error class: unknown class><AttributeKey<T2>, T2>, p3: <Error class: unknown class><AttributeKey<T3>, T3>): AttributeContainer
fun <T1, T2, T3, T4> attributeContainerOf(p1: <Error class: unknown class><AttributeKey<T1>, T1>, p2: <Error class: unknown class><AttributeKey<T2>, T2>, p3: <Error class: unknown class><AttributeKey<T3>, T3>, p4: <Error class: unknown class><AttributeKey<T4>, T4>): AttributeContainer

Returns a new AttributeContainer containing the specified key-value pairs.

Link copied to clipboard

Convenience function to set the background color within this builder.

Link copied to clipboard

Convenience function to set the blockquote attribute of the paragraph within this builder. The applied range will automatically snap to paragraph boundaries.

Link copied to clipboard

Convenience function to apply the bold text attribute within this builder.

Link copied to clipboard

Convenience function to set the bullet list attribute of the paragraph within this builder. The applied range will automatically snap to paragraph boundaries.

Link copied to clipboard

Convenience function to remove the background color attribute in the range.

Link copied to clipboard

Convenience function to remove the blockquote attribute in the range.

Link copied to clipboard

Convenience function to remove the bold attribute in the range.

Link copied to clipboard

Convenience function to remove the bullet list attribute in the range.

Link copied to clipboard

Convenience function to remove the font size attribute in the range.

Link copied to clipboard

Convenience function to remove the heading attribute in the range.

Link copied to clipboard

Convenience function to remove the inline code attribute in the range.

Link copied to clipboard

Convenience function to remove the italic attribute in the range.

Link copied to clipboard

Convenience function to remove the link attribute in the range.

Link copied to clipboard

Convenience function to remove the ordered list attribute in the range.

Link copied to clipboard

Convenience function to remove the strikethrough attribute in the range.

Link copied to clipboard

Convenience function to remove the text alignment attribute in the range.

Link copied to clipboard

Convenience function to remove the text color attribute in the range.

Link copied to clipboard

Convenience function to remove the underline attribute in the range.

Link copied to clipboard
fun <T> RichString.export(exporter: RichTextExporter<T>): T

Exports this RichString using the specified exporter.

Link copied to clipboard

Extracts a list of semantic ListItems from the given RichString.

Link copied to clipboard

Convenience function to set the font size within this builder.

Link copied to clipboard

Convenience function to set the heading level of the paragraph within this builder. The applied range will automatically snap to paragraph boundaries.

Link copied to clipboard

Imports formatted input using the specified importer to create a RichString.

Link copied to clipboard

Convenience function to apply the inline code text attribute within this builder.

Link copied to clipboard

Convenience function to apply the italic text attribute within this builder.

Link copied to clipboard

Convenience function to set the link attribute within this builder.

Link copied to clipboard

Merges a newSpan into this list of spans. Convenience extension that wraps transformSpans.

Link copied to clipboard

Convenience function to set the ordered list attribute of the paragraph within this builder. The applied range will automatically snap to paragraph boundaries.

Link copied to clipboard

Returns the index range of the first occurrence of the specified substring within this character sequence. This is useful for easily specifying ranges when applying rich text attributes.

Link copied to clipboard
fun CharSequence.rangesOf(regex: <Error class: unknown class>): <Error class: unknown class><IntRange>

Returns a lazily evaluated sequence of all occurrence ranges of the specified regex within this character sequence.

fun CharSequence.rangesOf(target: String, ignoreCase: Boolean = false): <Error class: unknown class><IntRange>

Returns a lazily evaluated sequence of all occurrence ranges of the specified target within this character sequence.

Link copied to clipboard

Re-snaps any spans containing ParagraphAttributeKeys to align with paragraph boundaries in the given text.

Link copied to clipboard

Expands this range to cover the entire paragraph(s) it intersects with in the given text. Paragraphs are delimited by '\n'.

Link copied to clipboard

Convenience function to apply the strikethrough text attribute within this builder.

Link copied to clipboard

Convenience function to set the text alignment of the paragraph within this builder. The applied range will automatically snap to paragraph boundaries.

Link copied to clipboard

Convenience function to set the text color within this builder.

Link copied to clipboard

Convenience function to apply the underline text attribute within this builder.