#197 ✓bluesky
Alexander Kucera

Markdown CSS

Reported by Alexander Kucera | December 6th, 2011 @ 09:04 AM

Hi Benny,

I have been quiet for a while but am still heavily using MailMate and still love using it.

I updated to the latest build yesterday and noticed that you now allow to create HTML e-mails from Markdown, which I think is a brilliant solution. Now since that is now possible, I am wondering if it would also be possible to write my own CSS to add inline to that converted HTML. I know, give them a finger and they go for the hand, but I think this would be an obvious level of customization to really make this Markdown->HTML implementation fly.

Best,
Alex

My system: MailMate/2619 MacPro4,1/i386/16/10.6.8

Comments and changes to this ticket

  • benny

    benny December 6th, 2011 @ 09:31 AM

    • State changed from “new” to “bluesky”

    Well, I feel quite strongly that most of the time the recipient should be in charge of how an email looks, that is, I like that Markdown restricts the user to the semantics of a message. That said, I have considered how CSS could be included when it makes sense (like a newsletter from a site where it would be nice to match the style of website and email).

    Currently, the HTML generated does not contain a header section, but in theory this could be generated as well with the opportunity to inline CSS. This could be implemented in the external program used to convert Markdown to HTML without really requiring changes to MailMate. A (MailMate) recipient wanting to ignore such styling could be given an option to always base the displayed HTML on the plain text (Markdown) body part.

    I've marked this ticket 'bluesky' to indicate that this is not a high priority. I would like to first encourage people to NOT use any styling in their messages. Then again, I cannot stop anyone from changing the external program used for Markdown to HTML conversion (but I could make it easier to do that).

  • Alexander Kucera

    Alexander Kucera December 6th, 2011 @ 09:45 AM

    Hi Benny,

    I know and understand where you are coming from. This harbors the potential for some hideous things, I agree. Then again, I was more thinking along the lines of more subtle things. But there is potential for abuse I agree.

    I would not mind digging in a bit if that means I get the ability to add this myself and leave you to do more important things. Can you maybe point me in the right direction?

  • benny

    benny December 6th, 2011 @ 10:19 AM

    Currently, the path for the binary used for conversion is hardcoded:

    MailMate.app/Contents/SharedSupport/bin/upskirt
    

    I should make this path configurable some way for you to make a proper solution.

    The binary is based on a Markdown converter used at Github. Here is my fork which contains some hardcoded changes. It needs to be updated since upskirt has since been improved (and renamed). It's on my ToDo :-)

    I suggest you do the following to experiment. Rename the upskirt executable, for example, to upskirt_core. Then make a script to replace it (with the upskirt name):

    #!/usr/bin/env bash
    
    printf "<!DOCTYPE html>\n<html>\n<head><style type=\"text/css\">\n"
    cat ~/stylesheet.css
    printf "</style>\n</head>\n<body>\n"
    upskirt_core
    printf "</body>\n</html>\n"
    

    Make sure the file is executable:

    chmod u+x upskirt
    

    And don't forget to create the stylesheet in your home directory. I just tried the above and there is one problem left. MailMate adds a <div> group around the entire result. This can be avoided by editing:

    MailMate.app/Contents/SharedSupport/Scripts/Markdown to HTML.mmCommand
    

    Or maybe by overriding it by placing a file in the app support folder.

    Obviously, the upskirt-replacement is replaced whenever I update MailMate, so the above is far from ideal. I'll keep it in mind.

    Note that the default stylesheet is not used when doing the above.

    Could you share your use case? Just so I know where you are heading.

    (Feeling a bit like opening Pandoras box...)

  • Alexander Kucera

    Alexander Kucera December 6th, 2011 @ 10:30 AM

    Well, my use case isn't clearly defined really. More of a bit of tinkering on my end.

    I do run a little company myself and wouldn't mind to bring the HTML rendering a bit more in line with the company CI. Nothing fancy really, just specify a set of fonts with a default fallback if it isn't available, change the background color very subtly and tinker with the spacing of bullet and numbered lists.

    You see? Nothing earth-shattering. But I get your point of feeling queasy. If you don't feel like this is a good thing to discuss openly because of possible abuse, we could close this thread and take it to e-mail. Or you could decide that you have said enough and I'll just go on an tinker with the info supplied so far. I also don't mind the hardcoded upskirt path really. It is after all just a symlink I'd have to replace once in a while. I am cool with that.

  • benny

    benny December 6th, 2011 @ 10:37 AM

    I would like MailMate to be as extendable as possible. I'm also pretty sure that the ones able to setup a CSS file do not share much with the ones who send messages with a Comic Sans font.

    So, I don't mind making it easier to make changes like the ones described above.

  • Alexander Kucera

    Alexander Kucera December 6th, 2011 @ 10:53 AM

    Cool. Great you have some trust in technically capable users. :)
    Thanks for listening Benny.

  • Philip Davis

    Philip Davis December 14th, 2013 @ 04:46 PM

    I was exploring the ability to add some limited css code to a MailMate message and found this discussion which is now a couple of years old. I'm wondering if your suggestion for modifying the markdown converter (2011-12-06) is still relevant.

    I use Brett Terpstra's nvALT for much of my markdown work and I find that the ability to occasionally modify the markdown text with something like the following can be very useful. This example forces a temporary format change when I paste my markdown in a WordPress page that sets the list-style to none.

    <style>
    ul li { list-style: square outside; }
    ul ul li { list-style: square outside; }
    </style>
    

    I understand why you tagged the original request as bluesky and that you probably will keep it in this category, but want to see if the original advice is still good before I go poking around with changing the converter. Also wondering if you still use the upskirt converter.

    I like the concept of keeping MailMate simple, but making it extensible wherever possible.

    Thanks
    Phil

  • benny

    benny December 15th, 2013 @ 07:35 AM

    • Tag changed from css, html, markdown to css, html, markdown

    Still using upskirt although it's name has changed to sundown. I don't recommend replacing it unless it's based on derivation of my sundown changes, but I know some users do it anyways.

    I'm a bit more likely to making it easier to generate arbitrary HTML messages (stylesheets and inline HTML), but I haven't done any work on it yet. No promises.

    Note that, in general, receiving email clients are far from as good at displaying HTML as browsers. They are simply not updated quite as often. Styling is also likely to be lost when a reply is generated, for example, MailMate would completely ignore any css-styling since replies are based on the plain text body part.

  • Alex Veer

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Mac OS X email client.

Shared Ticket Bins

People watching this ticket

Pages