rememberMarkdownState

fun rememberMarkdownState(content: String, lookupLinks: Boolean = true, retainState: Boolean = false, flavour: MarkdownFlavourDescriptor = remember { GFMFlavourDescriptor() }, parser: MarkdownParser = remember(flavour) { MarkdownParser(flavour) }, referenceLinkHandler: ReferenceLinkHandler = remember { ReferenceLinkHandlerImpl() }, immediate: Boolean = LocalInspectionMode.current): MarkdownState

A MarkdownState that executes the parsing of the markdown content with the MarkdownParser asynchronously.

Return

A MarkdownState instance that will parse the content and emit the result to its MarkdownState.state flow.

Parameters

content

The markdown content to parse.

lookupLinks

Whether to lookup links in the parsed tree or not.

flavour

The MarkdownFlavourDescriptor to use for parsing.

parser

The MarkdownParser to use for parsing.

referenceLinkHandler

The ReferenceLinkHandler to use for storing links.

immediate

Whether to parse the content immediately or not. (WARNING: This is not advised, as it will block the composition!)


fun rememberMarkdownState(vararg keys: Any?, lookupLinks: Boolean = true, retainState: Boolean = false, flavour: MarkdownFlavourDescriptor = remember { GFMFlavourDescriptor() }, parser: MarkdownParser = remember(flavour) { MarkdownParser(flavour) }, referenceLinkHandler: ReferenceLinkHandler = remember { ReferenceLinkHandlerImpl() }, block: suspend () -> String): MarkdownState

A MarkdownState that executes the parsing of the markdown content with the MarkdownParser asynchronously. This version accepts a suspend function block that returns the markdown content, allowing for dynamic loading.

Return

A MarkdownState instance that will parse the content and emit the result to its MarkdownState.state flow.

Parameters

keys

Optional keys that determine when the block should be re-executed. When any key changes, the block will be called again.

block

A suspend function that returns the markdown content to parse.

lookupLinks

Whether to lookup links in the parsed tree or not.

retainState

Whether to retain the state of the MarkdownState or not, when the input changes

flavour

The MarkdownFlavourDescriptor to use for parsing.

parser

The MarkdownParser to use for parsing.

referenceLinkHandler

The ReferenceLinkHandler to use for storing links.