We still need to parse "plaintext" messages through the markdown
renderer so that escappes are rendered properly.
Fixesvector-im/riot-web#2870.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Marked has some annoying bugs, and the author is inactive, so replace it
with commonmark.js, which is the reference JavaScript implementation of
CommonMark. CommonMark is also preferable since it has a specification,
and a conformance test suite to make sure that parsers are correct.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Preserves the old behaviour of not wrapping everything in p tags,
but also returns valid markup if the resulting markdown contains
multiple paragraphs (previously it stripped the <p> from the start
and the </p> from the end, leaving closing and opening paragraph tags
in the middle of the returned markup).
Also turn on the 'xhtml' option so marked uses self-closing tags
for br's, hr's and so forth.