Howdy, Stranger!

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

MarsEdit + + Code Syntax highligting

edited April 2012 in MarsEdit
I have the latest and greatest of MarsEdit and is looking at migrating some old blog with code in it over to a new blog I've set up. Problem is syntax highlighting of this code. Wordspress supports the [sourcecode] tags, but MarsEdit adds
and other formatting within those tags and it really screws up when it gets published.

Is there anything I can do to avoid MarsEdit from doing this, or a plugin for MarsEdit that enables code blocks or something. I'd really love to avoid having to dive into HTML to be able to do this.


  • Hi - unfortunately MarsEdit doesn't have any special knowledge of these WordPress "shortcode" tags. They are not legal HTML, so MarsEdit doesn't know what to make of them, and probably doesn't preserve them the way WordPress would like.

    It's on my TODO list to look into supporting "WordPress Shortcodes" better, but unfortunately for the time being I can't really endorse using MarsEdit in a situation where you need to make use of these codes.

  • Thanks for getting back to me.

    In my searching for an answer I saw server text filter being mentioned, is there any kind of script I could write that would be run automatically before it got sent to the server. That way I could strip away any HTML inside the shortcodes.

    Btw: Keep up the great work on the product - really loving it!
  • Currently there isn't any way to run an arbitrary script before sending to the server. This is something I would like to support in the future.

    Glad you are enjoying the app!
  • I'd like to echo the request for support of [sourcecode]

    It's an excellent way of presenting code in Wordpress blogs, and it's a pain not being able to use MarsEdit to work with posts that use it.

  • Thanks for letting me know.
  • +1 from me. I also have this problem.
  • How about marking certain posts as "HTML editor only" ? so that the rich text editor won't mess with posts containing special tags.
  • Thanks for the suggestion.I can imagine at some point supporting a concept of "content type" that would inform MarsEdit which editor is most appropriate. This would be useful for varying behavior for different kinds of markup too, like Markdown for instance.
  • I would also *very* much like to be able to use the Rich Text Editor for most of a post, but be able to paste (or select and specify) a literal piece of HTML that won't get wrapped in anything (not even whitespace or a


    That way, I could paste in a bare video embedding URL, or create a Wordpress shortcode, without having the entire post be in HTML.

    Right now, HTML or shortcodes are getting wrapped in

    . This is even the case if I use "Paste HTML Source" for some reason.

    Wordpress's magic requires the shortcode or special URL text to be on a line by itself, with no whitespace before or after on that line (let alone tags).

    Here's some info on their shortcode support:

    If you click on a particular type, e.g. Vimeo, you'll see how they support either a bare URL, or a shortcode to pass formatting parameters.

    (It would be even better if custom rich text macros could also set their contents to be literal HTML, so I could create a menu item that would create a shortcode and pull the URL from the clipboard. But I can do that with TextExpander if need be..)
  • Thanks for the link to the shortcodes documentation. I just need to sit down at some point and really think through what supporting those in MarsEdit would entail.

    As for the rich text macros I want to point out that in fact they are HTML based now. So if you have specific HTML you want to inject into a post from rich-text mode, a formatting-menu macro is a way to do that.
  • I've finally found a workaround for this. In short it's a combination of the <pre> tags that MarsEdit's rich text editor doesn't muck around too much (except for ampersands, at times) and with a special CSS class, some clever JavaScript-based plugin can automatically color those code blocks.

    Details here: Syntax Highlighting with MarsEdit on WordPress.
  • Thanks for sharing this!
  • What is the status for this problem ?
  • Any news about this subject ?
  • Hi Yves - I don't think there has been a significant change in the status of the issues discussed here. However, there are a few different things going on and being discussed here. Can you clarify what specifically it is that you are interested in?
  • edited August 2013
    I'm sorry. I realise that I should be more specific. I meant the support for the wordpress [code] tags.

    Are there any plans to make marsedit compatible with this tags ?
  • Hi Yves - it's still on my TODO list but unfortunately I don't have any news to report on that front. It's a little tricky with WordPress because much of MarsEdit is built on the assumption that HTML content will be "pure" and not contain these custom tags. That said, I believe they will work if you stick to HTML Text editing mode. (But obviously lose the benefits of using Rich Text mode).
  • Kudos to Adib. That technique works perfectly for me. Use the "pre" tag with a class attribute as described in the tutorial:

    Thank you!
Sign In or Register to comment.