buildMarkdownAnnotatedString

fun String.buildMarkdownAnnotatedString(style: TextStyle, annotatorSettings: AnnotatorSettings, flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor()): AnnotatedString

Extension function to build an AnnotatedString from a Markdown string. This function will parse the Markdown content and apply the given styles to the text.

It only supports TEXT and PARAGRAPH nodes.

Return

The constructed AnnotatedString.

Parameters

style

The base text style to apply.

flavour

The Markdown flavour descriptor to use (default is GFM).

annotatorSettings

Settings object to adjust different behavior of this annotated string.


fun String.buildMarkdownAnnotatedString(textNode: ASTNode, style: TextStyle, annotatorSettings: AnnotatorSettings): AnnotatedString

Extension function to build an AnnotatedString from a Markdown string. This function will parse the Markdown content and apply the given styles to the text.

It only supports TEXT and PARAGRAPH nodes.

Return

The constructed AnnotatedString.

Parameters

textNode

The AST node representing the text.

style

The base text style to apply.

annotatorSettings

Settings object to adjust different behavior of this annotated string.


fun AnnotatedString.Builder.buildMarkdownAnnotatedString(content: String, node: ASTNode, annotatorSettings: AnnotatorSettings)
fun AnnotatedString.Builder.buildMarkdownAnnotatedString(content: String, children: List<ASTNode>, annotatorSettings: AnnotatorSettings)

Builds an AnnotatedString with the contents of the given Markdown ASTNode node.

This method automatically constructs the string with child components like:

  • Paragraph

  • Image

  • Strong

  • ...


fun String.buildMarkdownAnnotatedString(style: TextStyle, linkTextSpanStyle: SpanStyle = style.toSpanStyle(), codeSpanStyle: SpanStyle = style.toSpanStyle(), flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), annotator: MarkdownAnnotator = markdownAnnotator(), referenceLinkHandler: ReferenceLinkHandler? = null, linkInteractionListener: LinkInteractionListener? = null): AnnotatedString

Deprecated

This function is deprecated. Use the new `annotatorSettings` function to create a settings object.

Replace with

buildMarkdownAnnotatedString(style, annotatorSettings, flavour)

Extension function to build an AnnotatedString from a Markdown string. This function will parse the Markdown content and apply the given styles to the text.

It only supports TEXT and PARAGRAPH nodes.

Return

The constructed AnnotatedString.

Parameters

style

The base text style to apply.

linkTextSpanStyle

The style to apply to link text.

codeSpanStyle

The style to apply to code spans.

flavour

The Markdown flavour descriptor to use (default is GFM).

annotator

An optional annotator for additional processing.