Create links for referenced images in MMD

EDIT

If anyone reads this thread and wants a simple How-To about sculpting inline and referenced images in Scrivener using MultiMarkdown, this link might help…

briarkitesme.com/2016/04/07/usin … scrivener/

Best

Briar Kit

+++++++++++++++++++++++

Hi

To create an inline image, we can use:

![Alt](/image.png "Title")

To create a referenced image, we can use:

![Alt][1] [1]: /image.png "Title"

To create an inline linked image, we can use:

[![alt text](/image.png)](http://example.com/ "Title")

But can we add a link to a referenced image?

![Alt][1] [1]: ??????????????

Thanks

Briar Kit

So far as I can see, the answer is ‘probably not’ (as ever, Ioa can give a definitive answer).

Any link would have to go in the resource details, after the filename. I’ve tried a few things and I can get this syntax to be processed through to HTML:

[code]![Image caption][limagelabel]

[imagelabel]: imagefilename width=400px target=“http://www.livinglantern.co.uk”[/code]

But, the problem is that the last part just gets spat out as an attribute in the link and isn’t any kind of formatted HTML.

Hi

Many thanks for the reply and help.

I’ve tried countless permutations, but have failed to strike lucky so far.

Logically, it feels as though it should be possible, but perhaps my logic is letting me down.

Thanks again.

Best

Briar Kit

Maybe I’m thinking about this the other way around, but it seems like the “Title” attribute has migrated to the hyperlink in the third example. If the progression starts with the first example, wouldn’t the third look like the following?

[![alt text](/image.png "Title")](http://example.com/)

As for linking a referenced image, just extend the logic in the above example and replace the inline image code with reference code:

[code]alt text

[/code]

This will result in the following HTML (note that both elements have their own title):

<a href="http://example.com/" title="Link title"> <img src="/image.png" alt="alt text" id="im1" title="Image title" /> </a>

You can even combine referenced links with referenced images:

[code]alt

[/code]

P.S. It’s nice to see you around again! :smiley:

Thanks, Ioa

Not near a Mac at the moment, so I can’t try your ideas right now, but I know you that what you have written will work.

[I believe in Ioa][BELIEVE]

I have mainly been using MMD with WordPress, and the syntax for the third example comes from its support site…

en.support.wordpress.com/markdo … reference/

Your final idea is closest to what I am looking for, with im1 and link1 in their own set of square brackets after [alt]. Pretty near perfect, though was hoping I could make it neater by only having one item after [alt] that references both the image and the link. Just want the body text to have as little distracting code as possible, dumping the referenced image and link info into a separate file that I can keep in its own peripheral split while writing. Your final syntax is banging on the door of Utopia.

And thanks for the PS.

Best

Briar Kit

Actually, MMD Valhalla for me would be to dump everything—including the ALT text—to the line of referenced syntax…

![im1] [im1] … ImageURL, ImageTitle, ImageAltText, ImageLinkURL

Time for me to try, try, and try again.

Best

Briar Kit

So, based on…

[code][alt][link1]

[link1]: http://example.com “Link title”[/code]

I tried…

[code]HATHAWAY – Eight Arias For A Bardic Life. A Helios Collective co-production with Buxton Festival][posterlink]

[posterlink]: http://www.buxtonfestival.co.uk/music-series/hathaway/ “HATHAWAY – EIGHT ARIAS FOR A BARDIC LIFE”[/code]

But “posterlink” comes up as a text link under the image:

[attachment=0]imagelink.jpg[/attachment]

Mmmmmmm

Best

Briar Kit

Hi Briar Kit,

Nice to see you back. :slight_smile:

Comparing your bits of code, it looks to me as if you are missing a [ right at the beginning in the latter case … could that be the problem?

Mind you, I know nothing about using MMD, so what do I know? :blush:

Mr X

Hi X (I am not one for titles; was brought up to show respect by using people’s names…only using titles in jest or derision)

Thank you and thank you again.

I am not at my Mac right now, but I have either copied the line into the post incorrectly, or you have proved that fresh eyes trump an addled brain. I am pretty sure that Ioa’s code must be right, that your eyes are better than my brain, and that I must have erred yet again. Doh.

Very grateful to you, X. Once more indebted.

Will try again when I get back to my Mac.

Best

Briar Kit

Bless those eyes: they saw the error of my ways. Ioa’s code works. I had missed out the opening [.

This works:

[code][HATHAWAY – Eight Arias For A Bardic Life. A Helios Collective co-production with Buxton Festival][posterlink]

[posterlink]: http://www.buxtonfestival.co.uk/music-series/hathaway/ “HATHAWAY – EIGHT ARIAS FOR A BARDIC LIFE”[/code]

briarkitesme.com/2016/03/18/savi … -hathaway/

Anne Hathaway. Saved. And Linked.

Now the quest to get it down to this syntax…

![im1] [im1] … ImageURL, ImageTitle, ImageAltText, ImageLinkURL

Many thanks, X. You may claim you know nothing about using MMD, but your nothing outshone my discombobulated efforts.

Best

Briar Kit

Hello Briar Kit,

I used to sign myself 'Mark", but then there were so many 'Mark’s who suddenly appeared on this forum, and for some time Jaysen had been calling me ‘Mr X’ from my username, that I just changed to that, and changed my forum signature to reflect it.

:slight_smile:

Mark

Hi Mark

I know. I’m a little left field. Or very.

And still very grateful for your help.

Have a good weekend.

Best

Briar Kit

If anyone reads this thread and wants a simple How-To about sculpting inline and referenced images in Scrivener using MultiMarkdown, this link might help…

briarkitesme.com/2016/04/07/usin … scrivener/

Best

Briar Kit