Right now, markdown handlers work by returning strings.
This works in easy cases but gets ugly in complex situations, where you have to manage indents and newlines yourself. Look at the html handler for example!
Instead, it might be nice to have a builder concept which you just add nodes to and, when finished, just call elementBuilder.toString()
So html can go from
sb.appendLine("$indent$elementName {")
for (child in children) { sb.appendLine($indent + 1, render(child)) }
sb.appendLine("$indent}"
return sb.toString()
to
elementBuilder.open(elementName)
for (child in children) { elementBuilder.add(child) }
elementBuilder.close()
return elementBuilder.toString()
Doesn't strictly have to be done before 1.0 but it would be a nice to have, to lock down markdown in case more and more people start using it / copying my code.
Right now, markdown handlers work by returning strings.
This works in easy cases but gets ugly in complex situations, where you have to manage indents and newlines yourself. Look at the
html
handler for example!Instead, it might be nice to have a builder concept which you just add nodes to and, when finished, just call
elementBuilder.toString()
So html can go from
to