I think first of all need to explain about some functions as markdown(init: MARKDOWN.() -> Unit), h1(init: HEADER.() -> Unit), h2(init: HEADER.() -> Unit)
etc. All of them called high-ordered functions because they operate with other functions in any way as that possible, in this case, i passed anonymous function(also known as lambdas) into each of them. Also, we should remember about type args limitation in these functions, for example, we can't use BOLD()
type without P()
wrapper. MARKDOWN, HEADER, BOLD
and other classes are support classes, which means they are not used explicitly and that why they have uppercase names. Each of them should call lambdas after initialization, that why we need doInit(child: T, init: T.() -> Unit)
function which does that. Another important thing that we need to know about operator overloading which gives us the ability to call +"Some string "
, but underhood it just means call extension functions String.unaryPlus()
and adding the processed string to the collectio