MarkdownListToIterable

abstract class MarkdownListToIterable<O, T>(list: ListBlock, inlineValueMapper: (Node) -> T, nestedValueMapper: (Node, ListBlock) -> T) : MarkdownListConverter<O, T, Node>

Abstract helper that converts a Markdown list to a flat (non-keyed) output of type O, by mapping each list item to an element of type T.

Inline and nested list syntaxes are both supported:

  • Extended:

- :
- value

(Note that the : character is not mandatory. Any string is valid since it's ignored by the parsing. : is the preferred one.)

  • Compact:

- - value

Parameters

O

type of the final converted output

T

type of individual element values in the list

list

list to convert

inlineValueMapper

function that maps the node of a list item to a value. For example, the paragraph node containing file1.txt in - file1.txt

nestedValueMapper

function that maps a nested list item to a value. The first argument is the parent node (e.g. the paragraph containing the label dir1 in - dir1), and the second is the nested ListBlock containing its children. In the compact syntax (- - value), both arguments refer to the same ListBlock node

See also

Inheritors

Constructors

Link copied to clipboard
constructor(list: ListBlock, inlineValueMapper: (Node) -> T, nestedValueMapper: (Node, ListBlock) -> T)

Functions

Link copied to clipboard
fun convert(): O