aTox icon indicating copy to clipboard operation
aTox copied to clipboard

Support rendering a subset of CommonMark in the chat

Open robinlinden opened this issue 4 years ago • 3 comments

The types implemented in this PR are bold, italic, and monospace text.

Resolves #238

robinlinden avatar Jun 27 '21 21:06 robinlinden

What about Markwon?

It has even a live rendered editor which can be binded to the message edittext.

roihershberg avatar Dec 30 '21 10:12 roihershberg

Back when prototyping this (this PR is not complete at all, just for a few testers to check it out and see what they though), I looked at different implementations but didn't find one I was 100% happy with, and since I only want a tiny subset of markdown, I figured the easiest thing would be to hack together a small parser (i.e. the regex is not intended to stay).

The things I want:

  • The formatting characters should not be removed when applying the style.
    • i.e. `text` should be rendered as `text`. This can be optional, but by default I want it to display all characters received.
  • Only emphasis, strong emphasis, strike-through, inline code, and code blocks.
    • It shouldn't be possible to try to inline images in messages, hide links, or apply colors etc.

This is apparently half a year old now, so if there are any small-ish markdown-implementations that check my boxes, that would be nice. :P I did look at Markwon, but I don't recall why I didn't like it, so maybe it's a fine option.

robinlinden avatar Dec 30 '21 16:12 robinlinden

From what I understood you can control pretty much everything in Markwon.

Why not remove those characters? Maybe it's possible to remove them like the default behavior but copying them when copying the message.

roihershberg avatar Dec 30 '21 16:12 roihershberg