Home Link

Hello, my name is Brett Terpstra, and it’s nice to meet you. Elegant solutions to complex problems. Curious?

Post thumbnail for post 522

MultiMarkdown in MarsEdit

MultiMarkdown in MarsEdit Tagged:
Jun 06, 2010 (610 days ago)

Mars Edit IconI’ve just started using MarsEdit1 again (in combination with my TextMate2 blogging bundles), but I’ve run into a couple of issues. First, I can’t assign thumbnails to my posts directly. This is the result of poor API support in WordPress for handling attachments on a specific post, and not Daniel’s fault at all. Fortunately, I’ve set my blog up to search for an image with a specific class, remove it from the post and use it as the post header if a thumbnail isn’t assigned. That works.

Second, my blog uses PHP Markdown Extra3, and a lot of the “extra” functionality was messing up my carefully-crafted preview in MarsEdit. Fortunately, a little searching on the Red Sweater forums yielded exactly what I needed4: you can add your own text filters with a little editing and some luck.

Markdown Extra shares most of the functionality I need with MultiMarkdown5, such as footnotes and quick, semantic tables. By copying the bin folder from ~/Application Support/MultiMarkdown/ to ~/Application Support/MarsEdit/TextFilters/ and renaming it from bin to MultiMarkdown (the exact same name as the executable), I was able to add the text filter without breaking a sweat.

Now, between MarsEdit and Edit in TextMate, I can do all of my blogging in Markdown Extra, offline, with full previews. I can manage categories and tags, excerpts and add media. Spectacular.

11 Responses to “MultiMarkdown in MarsEdit”

  1. What were you using before you used MarsEdit? The TextMate blogging bundle? I agree about WordPress making it difficult to insert thumbnails easily. The fact is that MarsEdit in its current implementation is a stellar product, as you point out: I can’t wait to see it ported to the iPad.

    If I understand you correctly, you post your content to WordPress in MultiMarkdown. Do you use Michel Fortin’s plugin to render it in WordPress? Although it’s an excellent solution, I’ve so far chosen to compose blog posts in MultiMarkdown, then convert them to HTML in TextMate and upload the resulting code in MarsEdit: I will feel more comfortable with actually posting on MMD once WordPress supports it out of the box. I also try to keep my plugins down to a minimum.

    A trick Daniel pointed out to me, but that I personally don’t use, may be useful to some people who want to convert Markdown to HTML prior to posting: because the rich text editor can only edit HTML, it has to convert the plain text not HTML when you switch. It does this using whatever the configured “Preview Text Filter” is, ie the same one used for the preview window. So if you edit a post in Markdown,and just switch to rich mode before publishing, it should do the trick.

    • Brett says:

      I’ve always blogged straight from a custom blogging bundle in TextMate. I’ve got some great commands for Markdown blogging, I plan to post the better ones eventually. I still edit the meat of the post in TextMate (using Edit in TextMate from inside the MarsEdit edit window), but MarsEdit adds much more visual management of blogs, better draft saving, and previews across all the places I post without having to hand craft Bash scripts to do it. It also handles media uploads better than the (outdated) Blogging Bundle, even if it’s not possible to associate attachments as thumbnails yet.

      I do post Markdown directly to WordPress with Michel’s plugin. I used to do all of my HTML conversion in TextMate before posting (still the way we have to do it on TUAW), but I’ve found that maintenance and editing is so much easier if they’re in Markdown. It’s a plugin I consider worth running, it doesn’t add any Javascript or CSS overhead, and I cache the rendered pages fairly aggressively, so the cost is almost nil. My only concern is if WordPress makes a major change that breaks the Markdown Extra plugin, and it’s no longer being maintained, my posts will all break. I’m not worried, though, as the plugin is easily modified and I could fix it myself if it came down to it :).

      Cool trick, though, I’ll have to try it out!

  2. Hi Brett — you mention in this post that your blog is configured to watch for images with a specific class and strip them out of the post, converting it to a thumbnail. The theme I’m now using at jasonclarke​.net aggressively uses thumbnails, and that has really been frustrating me with respect to using MarsEdit. Is it a tough thing to replicate (keeping in mind I’m not a coder)?

    • By the way, I forgot to say thanks for the tip! I’m just getting into using some of the Multi-Markdown (Markdown Extra) functionality, and had just bumped into the rendering issue. FWIW, your tip works great on MarsEdit 2 as well.

    • Brett says:

      I wouldn’t call it “easy”, but I can provide you with the code to pull it off. It basically just scans the text right before it renders the content for the post, and if it finds an image with the specified class it removes it and puts it where you want it to go. If your theme requires actual thumbnails assigned to the post, and uses them elsewhere (like the thumbnail teaser bar across the top of your site), it would probably require additional hacking that you may or may not want to get into. Drop me an email if you want to go over the details :).

  3. Thanks for the post. This was exactly what I was looking for.

  4. Simon says:

    Thanks for the post. Great information.

    Your page is awkward to navigate. Scrolling down or up makes the page jump to the bottom, which is rather frustrating. I’m using Safari 5.

    Marsedit is good.

    • Brett says:

      That’s curious. I primarily use Safari 5 and am not noticing any such issue. How are you scrolling? Mouse? What type of mouse? I’d love to get more info and make sure I can provide the best possible experience. Thanks!

      • Simon says:

        I’m using a macbook pro and scrolling via the trackpad. Curiously, it hasn’t happened once I restarted Safari. Might just have been a glitch in the matrix.

  5. Simon says:

    Just a quick mention. Your page only causes problem when I’ve zoomed in a couple of times and then try to scroll the page down using the slider at the side of the page. It then jumps all over the place.

Entries (RSS) and Comments (RSS), or Subscribe by Email