mistletoe
mistletoe copied to clipboard
Inconsistencies in the block tokens
There are some inconsistencies among the block tokens that maybe should be fixed before stepping up to version 1.0:
- Trailing newlines are sometimes preserved and sometimes not.
CodeFence
andBlockCode
preserve them;Paragraph
andHTMLBlock
do not. -
CodeFence
andBlockCode
keep their content in a singleRawText
child node, whereas theHTMLBlock
keeps it in thecontent
property. In fact, theHTMLBlock
is the only block token to have acontent
property. This is typically used with span tokens.
So what to do about it?
My suggestion would be to remove the trailing newlines from all block tokens. The other consistent option, to keep them for all block tokens, would add a trailing LineBreak
to all Paragraph
's, and that would just be a pain. Of course there's also the option to leave it as it is.
I would also suggest to place the HTMLBlock
content in a single RawText
node, so it would be consistent with the other block tokens. Maybe keep its content
property, too, in order to not break the API. The content
property could be turned into a property getter and marked as deprecated.
Thoughts?