[Standards] Markdown in XMPP IM

Peter Waher peterwaher at hotmail.com
Wed Jan 6 13:00:04 UTC 2016

Hello Travis, Steven, Goffi, Andreas & others
Thanks for your input. My responses below:
> Isn't the point of markdown that it's perfectly readable as plain text,
> ie that there is no markup?  I'd think sending straight markdown would
> be just fine.
The point of markdown is that it's easy to write and edit (focus is not reading, even though it's somewhat readable as well). I thought about sending markdown just as-is as well, but after thinking about it for a while decided against it.
The main reason is that text should only be interpreted as markdown if the sender knows it's markdown. That is, it's possible to write text that has markdown syntax in it, without meaning to, or knowing it's markdown, especially if you're using a client that does not know about markdown. So, text should only be interpreted as markdown if the receptor understands markdown, and if the sender intended to send markdown. So, some form of markup of the markdown is necessary.
A corollary of sending markdown in the same way XHTML-IM is sent, is that you can send a plain text version of the edited text as well. This is easy to do, if you already know markdown and can parse it. This means the sent message can be displayed in a simpler form, without showing possibly annoying markdown constructs.
> This could also be a client-side only feature, allowing input in
> markdown, then converting it to HTML and sending it as HTML-IM I suppose?

This would be a client-side feature. And markdown could be sent as XHTML-IM also, and the receptor can choose which one to display. However, markdown is simpler, and so markdown support should not require support for XHTML-IM.
> I'd say go with the XEP-0071 structure with a <markdown/> element and an
> appropriate namespace (is there a common one? Google turns up nothing).
> This leaves the standard <body/> element to contain your plain text. As to
> experience, none I'm afraid :)

I was thinking along the same lines. Markdown has no namespace that I'm aware of. Work is done to give it an Internet Content Type however:
> We use markdown in Salut ? Toi (http://salut-a-toi.org) and convert it to 
> XHTML-IM for microblog. We use a text only version (without markdown) for text 
> version.

Good to know. Thanks. I've been thinking of converting to XHTML-IM as well, but lean towards sending XHTML-IM as an alternative encoding instead of the default encoding. Sending markdown encoded as markdown has several benefits.
One disadvantage of XHTML as compared to markdown, is that XHTML is not easy to append or send in segments. (Tags must be closed). As markdown is text, you can send multiple markdown messages, forming a larger markdown text segment from several smaller, as segments easilly join each other in a simple way. One case where this might be useful (and now I'm thinking aloud), is if you send a markdown table, for instance. You could easilly append the table with multiple messages, and have columns align across messages.
> I would suggest just converting the markdown to XHTML client-side and
> sending that one, so you're backwards-compatible. The plain text could
> just be the markdown text, as Travis Burtrum suggested (although
> embedded links look a bit strange that way).

Backwards-compatibility could be achieved by sending XHTML-IM-encoded text as an alternative. But as I mentioned above, there are cases where the markdown might be of interest in itself. And converting XHTML-IM back to markdown on the receiving end is not as simple as creating XHTML-IM from markdown.
Best regards,
Peter Waher

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/standards/attachments/20160106/3ad69a2f/attachment.html>

More information about the Standards mailing list