parseInlines

fun parseInlines(text: String, resolveRef: LinkRefResolver? = null): List<Inline>

Parses inline markdown content from raw text into a list of Inline nodes.

Handles:

  • Backslash escapes

  • Code spans

  • Emphasis and strong emphasis (* and _)

  • Hard breaks (two spaces + newline, or \ + newline)

  • Soft breaks (newline)

  • Links and images (inline, reference, collapsed, shortcut)

  • Autolinks and raw HTML

  • HTML entities

  • Plain text

The algorithm works in two phases:

  1. Tokenize the input into a flat list of inline tokens (content + delimiter runs)

  2. Apply the emphasis matching algorithm (CommonMark §6.2) to produce nested inlines