Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rendering a subset of CommonMark in the chat #778

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robinlinden
Copy link
Collaborator

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

Resolves #238

This is a very simple (and non-compliant!) implementation and will be
replaced by something more proper later. Overlapping styles aren't
handled at all right now.
@roihershberg
Copy link
Collaborator

roihershberg commented Dec 30, 2021

What about Markwon?

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

@robinlinden
Copy link
Collaborator Author

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.

@roihershberg
Copy link
Collaborator

roihershberg commented Dec 30, 2021

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.

@robinlinden robinlinden marked this pull request as draft January 12, 2022 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for code/monospace text in chat
2 participants