Using Markdown with MarsEdit
  • When previewing a post in MarsEdit that is going to my blog on Blogger, I see that the Markdown code is correctly turned into html when I use the "Markdown" filter. I assumed that when MarsEdit uploads my post to blogger it would also convert the Markdown code to html so that Blogger would render the post exactly as MarsEdit did for the preview.

    However, I see that the Markdown code is sent to Blogger without translating it into html. I've checked all the menus and settings but can't find an option that says something like, "Convert Markdown to html before sending to blog". Is there such a setting?

    The more I think about it, the more I'm convinced that MarsEdit purposefully sends the Markdown code and assumes that the blog will also understand Markdown. That way the local version and the blog version would be in sync. However, in the case of Blogger, there doesn't appear to be a way for it to handle Markdown. Perhaps other blogs do this, but Blogger doesn't.

    Unless MarsEdit gives me an option to convert Markdown code to html before sending it to Blogger, I can't take advantage of the simplicity and transparency of Markdown: I am better off writing in html in the first place. Or perhaps I need another program that exports html from a Markdown source and then paste that html into MarsEdit. That would be a pain since every time I wanted to make a change I'd have to go back to the original code, change the Markdown, export the html, and then paste it into MarsEdit, which then uploads it to Blogger. In that case I'd be better off not using MarsEdit and just paste the html code from the Markdown software directly into Blogger.

    Have I missed something?
  • Hi Harvey - yeah, unfortunately you are missing a shortcoming in MarsEdit which is that it doesn't have any built in "automatic convert to HTML before publishing" feature. This is because historically it has counted on blogs where Markdown is popular doing the conversion themselves on the server side. There are e.g. plugins for doing this on WordPress, and on Tumblr it can be set to do it automatically.

    In your case since you are on Blogger you have no choice but to give up the possibility, as you noted, of having the content stay in Markdown on the server so it can be easily updated in the future.

    Although there is no way (yet?) to set it to automatically convert to HTML on publishing, it is possible to get it to quickly change to HTML if you get in the habit before publishing of simply switching to Rich Text mode before sending. When you write a whole post in Markdown in HTML Text mode, and switch to Rich Text mode, it uses the current preview text filter to convert the content to HTML for the Rich Text editor. This effectively causes all your Markdown content to change to HTML and you can then send it to any blog whether it supports Markdown or not.
  • Daniel - Thanks for your helpful and comprehensive response to my question. I suppose the real problem is with Blogger for not having a Markdown plugin like other web-based blog creation software.

    Thanks for your suggestion about converting to rich text mode before sending the blog post. That looks like the best approach under the circumstances.
  • Yes - it would really be ideal if Blogger supported Markdown natively, so that the content could stay in Markdown forever and only convert as needed for web display. I am glad to hear the rich-mode trick will be helpful for you for the time being. I hope to make this more streamlined in the future.
  • Another possibility would be to integrate a markdown library. So many programs do this that I wonder if it wouldn't be a good option?

    For the end user, it is possible--though I don't do it--to have a Service (or a TextExpander or similar shortcut) that pipes markdown content through a markdown converter and then pastes it back in...all within MarsEdit.
  • fncll: do you mean integrating a Markdown library into MarsEdit? Well functionally it does already have it, that's what the "switch to rich mode" trick is doing, is coercing MarsEdit to use its Markdown capabilities to convert the text. It's just a matter of offering a more convenient mechanism for doing that conversion e.g. automatically upon posting.
  • I'd be very interested in integrating either pandoc or pygments as an external converter to use with marsedit. Ideally I'd be able to create the post in markdown and then get marsedit to pass the output through the converter before shipping to the server. Is there any API or hook to support this?
  • Hi - unfortunately MarsEdit doesn't support this kind of scripted processing before sending to the server. It's something I have wanted for a long time but haven't had a chance to add yet.

    The closest thing to it is if your server happens to be static file based you could use MarsEdit's "Blosxom" support. It publishes files locally on your Mac and then gives you an opportunity to run a custom script on the content which could really do anything, including running the pandoc or pygments on them and then copying to a server. Unfortunately this script can't be run as part of the process to publishing to e.g. WordPress or another API-based blog in MarsEdit.

    Daniel
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!