toMarkdown

fun AnnotatedString.toMarkdown(configuration: MarkdownConfiguration = MarkdownConfiguration.DEFAULT, links: List<Pair<IntRange, String>> = emptyList(), styles: RichTextStyles = RichTextStyles.DEFAULT): String(source)

Converts an AnnotatedString to a markdown string, handling supported markdown styles. Only converts styles that match our supported markdown styles, dropping any unsupported styles.

Parameters

configuration

The syntax choices to write in.

links

Hyperlinks to emit, as text ranges (in this string's character offsets) paired with their destination URLs. Each becomes [text](url), with the markers enclosing any emphasis inside the range.

styles

The styles a span is recognised by; an editor's own are on TextEditorState.richTextStyles.

A string carries no heading blocks, so a run bold at one of styles' heading sizes is written as that heading, on a line of its own.