RtfToAnnotatedString

Builds a Compose AnnotatedString from an RTF document. Tracks bold (Command.b), italic (Command.i), underline (Command.ul) and strikethrough (Command.strike) and applies the matching SpanStyle to each body-text run. Body-text filtering matches com.darkrockstudios.libs.rtfparserkmp.converter.RtfToMarkdown: only Command.rtf, Command.pntext and Command.fldrslt destinations contribute text.

Command.par, Command.line and Command.row yield a newline; Command.tab yields a tab.

Character formatting is group-scoped: a snapshot of the formatting state is pushed at each group start and restored at the matching group end, mirroring how RTF braces scope formatting (e.g. {\b bold} resets bold at the }). Explicit \b0/\i0/\ul0/\ulnone toggles still mutate the current state within a group.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Closes any open span and returns the accumulated AnnotatedString; call after parsing finishes.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun processCommand(command: Command, parameter: Int, hasParameter: Boolean, optional: Boolean)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun processGroupEnd()
Link copied to clipboard
open override fun processGroupStart()
Link copied to clipboard
open override fun processString(string: String)