Mailspring: Feature Request: Markdown

Created on 23 Sep 2018  路  17Comments  路  Source: Foundry376/Mailspring

Feature Request

Hi,

I would like to request a new feature around Markdown. From reading the doc and this forum, there is currently some support for Markdown. However, Mailspring, like in fact most email clients, should do this slightly differently. I would argue that one of the main reasons people use and like Markdown is not that it saves some clicks and allows to write everything from the keyboard with ASCII input. That's nice but that's not the main thing. The key thing is that Markdown is not WYSIWYG. If you want consistently well-formatted emails that look good on the recipient side, Markdown is key. Formatting problems occur mostly in two ways:

  • Replying inline to HTML emails leading to potentially irregular fonts
  • Copy/paste into the composer window from another application

In the worst case, this can insert weird characters that do not show up in your email client but will show up on the recipient side. Examples include unexpected line breaks. Small font changes that are not easy to see in the sending client can show up as visually very different fonts on the receiving client.

So Markdown takes care of all of this by removing all "hidden" styling commands in the composing window and using only ASCII input.

The only email client that I know about that does this well is Mailmate (markdown discussion).

You need two main features for this to work:

  1. Something that converts entries (copy/paste or existing HTML from a replied-to email) to the nearest Markdown equivalent. Example: Turndown.
  2. A way to preview the email. That's not critical since in 90% of cases the preview is somewhat self-obvious and is not needed, but there are a few cases where you want to see the result to make sure it's what you think it is.

Thank you.

Most helpful comment

I have been using mailmate for a while. I think mailmate's approach is great. You write down your markdown in text. There is a button to display or hide a preview. It's simple and works great. You can copy/paste in your text window with no formatting problem. The replied-to message is shown in HTML below your message. If you want to "reply inline" and modify that text, the HTML gets converted to markdown text. When you add your reply, it works seamlessly. Everything is then just markdown and you get a clean output with a consistent font. At the same time, if you just reply above the message and don't touch it, the original HTML remains untouched in your reply, which is good. It's a great combination of convenience and the output looks great. The emails are nicely formatted with a consistent look.

All 17 comments

Valuable feedback! I actually had never thought of markdown for email but it does make sense, I write markdown for other things so why not?

Thinking about the implementation I would like to avoid having a "panel" for previewing, my personal feeling is that the UI should remain as simple as possible and having a preview tab or similar would make it look more complicated.

I remember seeing a markdown plugin for Sublime or VSCode that as you type it would convert the text into the "preview" version keeping the markdown syntax, is this an acceptable solution @ghuba ?

One thing to consider is the integration with the current formatting tools, font size I guess would be heading levels...

I see your point. Designing a good UI is very important. As far as I know most editors have a separate preview window. That's the case for Atom, Sublime, and VSCode. Typically you have a preview window on the right that gets updated live as you type. That's really the only interface I have seen so far across many tools. Mailmate and Airmail both have a preview window (Airmail to the right and Mailmate below). Airmail is more basic. It will not convert a replied-to HTML email to Markdown. You can just type your message in Markdown at the beginning and that's it.

Thinking about how this could be done without a separate preview panel, we need to let go of the ASCII view. Hum... that's one of the attractive things of markdown but not really required. You could use the existing interface with a few tweaks.

image

Among these buttons, most of them make sense for Markdown. A few buttons that should be removed: color, font family, vertical spacing, emoji, ... They could be greyed out and deactivated.

Am I understanding your suggestion correctly?

The main difficulty is then to properly convert copy/paste content and replied-to HTML to Markdown. Then convert markdown to HTML when sending the email (but that part is relatively straightforward).

How about something like this:?
Ilike this

The first block of text is the "before", as you type the text gets converted in the same panel into the "hybrid" markdown/html-enhanced version, so it keeps the markdown syntax and the visual improvement.

My understanding is that you would like to type markdown and have a visual feedback before sending the mail, I believe this accomplishes it without adding a new panel to the interface or creating a new "mode". The client can send both the html version (as seen by the user, or converted from markdown into plain html) and the plain text version (pure markdown), MIME allows that and the mail client decides which one to show

Yes, that would work very well I think. This is breaking new ground in email composers!

I would like to follow up on this discussion. There is another approach I would like to suggest. The downside of what you are proposing is that it may confuse the non-markdown user and on the other hand the markdown user may be expecting the usual ASCII input. There is another approach that may be more consistent with the Mailspring experience. One of the issues Markdown is addressing is a consistent and clean format for emails. Currently in most (all except Mailmate) clients, the main option to clean up weird font formats is the remove formatting button. See the last icon in Gmail

image

However this button is pretty simplistic. It removes all formats included quoted content (replied-to email) and inserts blank lines in odd places (e.g., in quoted emails). This suggests that we could have a "smart" button (call it M) that in effect does a "Markdown" formatting similar to what you are proposing above. Namely it would remove HTML tags that change the font family and font size but keep the quoted content, lists, and url links. Essentially something that takes some HTML content and in effect do: HTML -> Markdown -> HTML. Weird but it has 2 advantages:

  1. It keeps the current Mailspring input and UI.
  2. It clears up formatting issues that Markdown automatically enforces.
  3. That may not be too difficult to implement. You take the HTML content of the email and run it through two pieces of code.

I agree with what you said and support it, I think I can start looking into this next week, it may also give enough time for others to share their feedback :)

Hi Guys, I totally agree with you. Markdown is a great feature for any mail client. But it must have a very easy interface. As an old markdown mails user the best plugin I've used is https://markdown-here.com/. I've used extensively on gmail web-client.
This plugin can be used on any text input for chrome/firefox, you write raw markdown and to render you press Shift+Alt+M, if you press again you go back to raw text. It's like a preview but in place.. without having to deal with two windows.
It's a very popular plugin for gmail users (especially developers who are more familiar with MD).
Perhaps is a good idea to make a plugin based on markdown-here.
Another place to check is Old Nylas has a markdown plugin https://github.com/nylas/N1-Markdown-Composer.

I'll be glad to collaborate if needed!

Cheers

I have used markdown-here but the way you can toggle back and forth is a bit confusing. In particular, if you toggle back from HTML to text input, it erases any changes you may have made while in the HTML mode. The way you use it is you write the text input, toggle to HTML to view the result "in place", toggle back to text input, and continue typing your email. It's OK but not straightforward. I still feel a preview window is the way to go. You have straight text input and you preview on the side. It's clear and simple. No confusion and easy to use. Anyway, that's my vote.

I have used markdown-here but the way you can toggle back and forth is a bit confusing. In particular, if you toggle back from HTML to text input, it erases any changes you may have made while in the HTML mode.

@ghuba you're right with this. I've also struggle with that, think is a bug. Perhaps, when being on markdown mode, html should be readony.
Either way, with or without preview window, think is a must have feature! :+1: So, if help wanted here count with me. @purefan

Another to resolve here IMO is the embedding images inline, think this should work fine whether you are on default mode or markdown mode.

I have been using mailmate for a while. I think mailmate's approach is great. You write down your markdown in text. There is a button to display or hide a preview. It's simple and works great. You can copy/paste in your text window with no formatting problem. The replied-to message is shown in HTML below your message. If you want to "reply inline" and modify that text, the HTML gets converted to markdown text. When you add your reply, it works seamlessly. Everything is then just markdown and you get a clean output with a consistent font. At the same time, if you just reply above the message and don't touch it, the original HTML remains untouched in your reply, which is good. It's a great combination of convenience and the output looks great. The emails are nicely formatted with a consistent look.

+1

I recently switched from mac to pc. I used Mailmate on mac (it's really good) and it uses markdown for composition. It's definitely the best way of composing email in all my decades of experience.

Yes, please add Markdown to Mailspring! Basic HTML support with it also would be great!

Maybe similiar as GitHub does it? You can choose to compose email in either RichEditor or Markdown and switch between modes with option to preview anytime.

One of the best Markdown apps I have ever used is Notable. If you ever need any ref I strongly recommend to check it. 馃槈 Currently I'm just writing emails in VS Code and copying them directly to Gmail/Mailspring. Unfortunately Gmail handles content rendered from Markdown better than Mailspring, but Mailspring does much better work with content rendered in HTML. :/

Personally, I would strongly prefer being able to write markdown in plain-text. I find myself constantly getting stuck in fixed-width mode in the mailspring editor, because after typing the closing back-tick, I realise that I've made a mistake, and then try to go back and fix it. I have not found a quick and elegant way to tell mailspring to put me back in "normal text" mode when this happens.

(Exactly the same thing is now happening to me in slack, since they rolled out their WYSIWYG editor: https://twitter.com/FSLeyes/status/1197474082138337281)

+1 to github's write/preview interface - mailspring could just have two tabs allowing the user to switch between plain-text and the existing WYSIWYG editor.

This would be awesome.

There are chrome extensions that do this:

https://markdown-here.com/

@pauldmccarthy I agree it would be great if we could have the option of composing emails using a text editor when using Markdown. So long as there was preview utility or the ability to use something like Marked2 for the preview.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purefan picture purefan  路  3Comments

enoversum picture enoversum  路  3Comments

spartero picture spartero  路  3Comments

dgattey picture dgattey  路  3Comments

3v1n0 picture 3v1n0  路  3Comments