Mars Edit makes custom code easy

13 May 2010 · 0 comments

Mars Edit’s handy macro palette makes it easy to use custom coding in your blog Posts. Here’s how it works.

I sometimes need custom coding when I write blog posts. For example, the Thesis theme has two built-in paragraph styles: note and alert. To use them I need to add class="note" or class="alert" to the paragraph tag. Here’s what they do:

This is a Note.

This is an Alert.

Mars Edit Markup Macros window.

Mars Edit Markup Macros window.

If I include a Google map, using the WP Geo plugin, then I need to use the short tag: [wp_geo_map] in the body of the Post.

For example, I just listened to a fascinating interview about Pitch Lake and the organisms that live in it:

Your first mental picture of a lake in a tropical resort island like Trinidad and Tobago probably couldn’t be more different from Pitch Lake. Pitch Lake is a bubbling, stinking, sticky deposit of degraded petroleum that’s been mined for more than a century for road-asphalt. It turns out, though, that Pitch Lake is also alive.

Hmmm … Trinidad and Tobago? … ah.

Add custom code to the Format menu

Rather than typing out these extra bits of code every time I need them I insert them from the Mars Edit Format menu. It’s easy to edit items in that menu:

Add or edit a Markup Macro.

Add or edit a Markup Macro.

  1. Go to the Format menu in the menu bar.
  2. Click on Edit…. The Markup Macros window appears.
  3. Select an item beneath which you want your new custom code to appear (or add it anywhere and drag it into position later).
  4. Click the + symbol at bottom left of the window. The macro edit window appears.
  5. Enter a name, and then any custom coding you require.
  6. Click OK to save the macro.

Tips for macros

The Name is just for your reference. Make it meaningful to you. Sometimes I use the custom code itself, at other times I use a ‘shorthand’, such as div youtube.

Click in the Shortcut field and press a combination of keys to set that combo as a quick way to use the custom code. In the first screenshot you can see that Command (⌘) Shift (⇧) A lets me quickly Paste a Link.

Insert a Placeholder such as Selected Text to wrap your custom code around text you’ve already typed.

Use the macros

To use a macro, first make sure you have selected where it should appear, then:

  • choose it from the Format menu in the Menu Bar
  • choose it from the Format dropdown menu in the ToolBar
  • type the custom keystroke you selected.

A map showing Trinidad and Tobago

Pitch Lake is near La Brea (Thanks Wikipedia).

Be the first to comment ⇒

Tell us what you think.
Note: there may be a delay before your comment appears. I now approve all comments from new visitors, in an attempt to keep spam at bay.

Add your Comment

Older Post:

Newer Post: