I hope this idea will be of value to some of you.
I now use Markdown-Here for almost all of my emails and it really has made a great improvement in the appearance of my email. I have a gmail account.
However, there are occasions when I can’t use MDH because the underlying Github Markdown doesn’t support the features I need, such as footnotes. I’ve followed Adam’s suggestion and submitted a feature request for footnote support.
When I use MDH and want to do sometime like make the h4 heading level show up in red in my gmail, I simply modify the MDH CSS to add the “color:red” style to the h4 section. Then, when I write a line like:
the line is indeed rendered in red.
The problem comes when I want to use footnotes in addition to making h4 show up as red. That precludes using MDH. I’ve spent a few days trying to figure out how to convince gmail to use the styles that show up in the previews of stand alone Markdown editor. I’ve selected all text in the preview window of editors like, for example, Byword for the Mac and then copied and pasted the clipboard into the compose window for gmail. Some of the attributes, like bold, italics, links, and even footnotes work fine. But the styles for color and heading size don’t work. All headings are in black and, strangely, are all the same size.
Eventually I stumbled on this article. This post answered my remaining questions. Here are the steps to get styled html into gmail when you can’t use MDH:
(This is for a Mac)
I imagine that Windows Markdown editors with previews might work similarly. Obviously what you want is a Markdown editor with a preview (or a stand-alone previewer like Marked) that can export the preview to an html file. You should be able to control the CSS for the preview and the resulting html file should have the previews template in the output.
Considering all the steps in this alternate for Markdown-Here, it is clear why MDH is a much better way to render styled Markdown in Gmail. But if you can’t use MDH because you need footnotes or some other style not present in the Github Markdown, at least there is another way to create a styled gmail.
Thanks for this, Harvey.
There are a couple of things you might already know about, but some of your wording makes me suspect that maybe you don’t. And maybe they’ll be helpful!
Most people probably just click the Markdown Here button and render their whole email. But you can instead just highlight part of your email and then click the MDH button and render just that part. Here’s the screenshot for it from the README (full size):
If you want a h4
to show up red once (like, not as your normal thing), you can do this:
#### <span style="color:red">I'm a Red Head</span> (sorry!)
If you do stuff like that regularly, or if you have additional special styles you’d like to use but don’t want to keep typing, you can add a CSS class to the MDH Primary Styling CSS. For example, I’ll add this to mine:
.special {
color: red;
font-style: italic;
font-size: 1.3em;
}
And then I’ll use it like so:
<span class="special">I'm so special!</span>
I’m so special!
The one thing I was aware of was that you can use MDH on just a block of selected text instead of the whole email. I use a signature block with large Italic fonts, an image, and colors in gmail and I don't want to subject that block to Markdown conversion, so I always select everything but the signature block before calling upon MDH to convert the Markdown. However now that you've explained how to create styles within the CSS and use them in the email document, I can probably create the styles I need for the signature block within the CSS.
I only have one question: is the information you provided in your comment specific to MDH or could I do the same thing in other Markdown environments where I have access to the CSS? I'm asking because I often write small ebooks in Markdown and create the ePub file in Sigil. If I were to create styles in Sigil's CSS and use <span> code in my Markdown for the ebook, would that work the same way as you outlined? Or is the technique you explained only for MDH?