Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions message-markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Markdown in messages

> This list is for every formating thing that goes beyond plain-text.

Deltachat is going to support the following subset of markdown:

### `*italics*` and `_italics_`

No whitespace as first nor as end char:
correct:

```
*italics* test
*italics test*
```

wrong:

```
* italics* test
```

### `**bold**` and `__bold__`

No whitespace as first nor as end char: see italics examples.

### `~~strikethrough~~`

No whitespace as first nor as end char: see italics examples.

### `https://delta.chat` - Urls

Make URLs clickable.

### `<http://example.org>` - Urls

### `` `inline-code` ``

useful to send non markdown text in your message like source code snippets.
Should get rendered in a monospace font and with a different background.
In contrast to bold, italics and strikethrough the content of inline-code can contain spaces at begining and ending.

### ` ``` fence code block ``` `

```
Similar to `inline-code` but not inline and it may supports code highlighting.
```

` ```[lang?] [content]``` ` (square brakets symbolize being a variable and are not used when using code blocks)
A bit modified from the common syntax to allow one liners.
Also get displayed with an monospace font (a side effect of this is that it allows to display small ascii art).
The code **highlighting** is **optional** as implementation (time)cost
may not be worth the small gain.
The `language` definition should be parsed separately and omitted in this case (for oneline code blocks, because we cant differentiate it from content in this case).
So the `language` definition is only detected if there is an linebreak following it.

see https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting

examples:

<pre>```sh
echo hi
```</pre>
<pre>```
echo hi
```</pre>
<pre>```echo hi```</pre>

### `:emoji:`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never got the point from these kind of emoji ... esp. as we already support utf-8-emojis directly. I would strike that for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its mainly that you can type an emoji without searching it in the loooong emoji keyboard.
Telegram or discord for example provide also auto completion with this syntax

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, that's a point :lach: mainly useful for desktop. however, maybe the type-in can be converted to a unicode character before sending.

Copy link
Member Author

@Simon-Laux Simon-Laux Jul 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its also useful on mobile, try typing :+1 for example on telegram on android (I am not sure if telegram iOS has this feature too right now because I haven't used telegram iOS in a while.)


- could also be used for custom dc emojis

### labeled links: `[Name](url)` links

When implementing this make sure to show the user the hidden url in a confirmation dialog to make scamming harder.
Also show the url as encode punycode to make punycode attacks useless.
Optionaly a client can implement a system to trust an domain (an "don't ask a again for links on this domain" checkbox in the confirmation dialog)

### Bot `/commands`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex could look like this (but keep in mind that this doesn't allow whitespaces inside of the command):

/(\/[a-Z0-9]+)\s/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also should the current draft be replaced by it or only if the draft is empty? CC @r10s @adbenitez

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the current android implementation taken from @adbenitez replaces the draft.


On click the command gets prefilled as the draft so it can be easialy send.

## `#tag`

Basically a clickable search shortcut. On click it opens the message search prefilled with that tag.

Inspired by twitters and telegrams #hashtag funtionality.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still need to discuss how to parse hashtags:
telegrams rule seems to be

  • # everything (besides #) until space/linebreak/tab
  • must end with EOF/space/linebreak/tab (but don't consume it)


## Future:

### `mailto:[email protected]`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here i suggest to use mailto:[email protected] instead, however, emails and most http-links are already now clickable on android without special formatting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan is to put every formating thing on this list that goes beyond plain-text. Maybe the naming of the file could be improved in that regard

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here i suggest to use mailto:[email protected] instead, however, emails and most http-links are already now clickable on android without special formatting.

plain email addresses are clickable on dc-android, but mailto: urls aren't :(


Make mailto links clickable with all parameters: `?subject=Sample%20Subject&body=Sample%20Body`

### Custom Deltachat URI Scheme

see https://support.delta.chat/t/custom-deltachat-url-scheme/346

### Mentions `@username`

Clickable. (could get replaced with an user hash/email/id on send/on recieve so that it's still valid on name change.)
Copy link
Member

@r10s r10s Jun 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that would be nice. however, it might get a bit tricky as there is not really a unique username currently. @[email protected] looks a bit strange.
however, as it is in the "future" section, it's probably fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user will probably type the current username, but dc can save/transmit it in another format.
Discord has an even more strange code https://blog.discordapp.com/how-discord-renders-rich-messages-on-the-android-app-67b0e5d56fbe

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

however, it might get a bit tricky as there is not really a unique username currently.

one idea is that as simon says, when mentioning the original email contains the user's email, just that dc replaces/show that email in messages as a @tag with the display name we have for that user, if we don't know that address the full email should be shown then, it is just a display thing, internally no name is sent, only email addresses which should be unique


On sending/recieving this is tranformed into an internal representation:

Implementation idea:

1. user types @Displayname and at best gets autocompletion while typing the url
2. on sending the username is converted to the transmition format (special format that contains the email address as id)
3. on recieving/storing the message inside of the database this format is converted again to contain the local contact id to allow for future email address migration/rotation.
(4.) on forwarding/sharing as chat history the id representation needs to be converted from the contact id format to the transmition format again

see discords mention code for reference/inspiration https://blog.discordapp.com/how-discord-renders-rich-messages-on-the-android-app-67b0e5d56fbe

### $[inline TeX]$ $$[Tex displayed in block(new line)]$$

for sharing math/physics equations in LaTeX format.
see https://support.delta.chat/t/latex-code-in-deltachat/558

### Telephone numbers (idea)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a tricky question to decide if/how we support it. most chat/android apps do this rather wrong and suddenly every longer number is detected as telephone number.
we detect only specific well-defined telephone number formats.
but anyways the whole thing is a whole science on its own so maybe we should just use tel:number links for now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ftr: we are currently relying on what android/ios system suggests wrt phone numbers, iirc, that not that bad.


- format: +[country][area] [number] (again square brakets indicate variables)
make them clickable similar to `tel:` links

## Things that will not be suported:

- Inline HTML
- underline - can be confused with links

## other / internal

- Text
- linebreaks