Next Riot

Swift, Xcode, Cocoa & iOS thoughts, tips, tutorials & tricks by Kyle Gillen of Next Riot

Catch me on Twitter
Subscribe via RSS

Subscribe to my Swift Newsletter

Adding images in Markdown (and iA Writer… and Swift)

Posted on

Keepin’ it Swift

This is a Swift blog after all, so I would be remiss if I didn’t somehow tie-in a Swift easter egg here. The ever-amazing Swift evangelist, @ericasadun has written a great article on using Markdown in Xcode 7 comments to beautifully format your Swift header documentation (she even shows how to add images to your header docs that can be previewed in Quick Help).

Highly recommended, as are all of her great posts.

Swift header documentation in Xcode 7 by Erica Sadun.

The wrong way?

I use iA Writer as my goto Markdown editor & I highly recommend it. I find it odd however that in their non-pro version of the software (at least), adding images isn’t readily accessible. Furthermore, their online documentation gives an erroneous description on how to do this:

Currently only web-accessible image URLs are supported. On export to RTF or .docx, currently the image’s alt text is added, but the image is not embedded. You can add images via the following syntax:

<figure><img src="" alt="image"></figure>

iA Writer Markdown Guide

The right way?

The correct syntax – that allows you to preview your images alongside your markdown (Cmd + T) in iA Writer – seems to be the following:

A link (http…), preceded by a bang (!) & the image’s title text within square brackets.

This post may be short-sighted, and there’s a good chance I’m missing something. If that’s the case, please let me know in the comments below, and I’ll make the necessary corrections.

  • R. E. Warner

    Every example I can find has “http:” as part of the image source. Is there no way to include a *local* image in a markdown image include?