2

How can I insert an image in a markdown section in lektor. In particular, does the url filter work inside markdown, or who else to I reference the image location inside assets/static/?

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Bud P. Bruegger
  • 1,021
  • 10
  • 15
  • Very good question, I was about to ask that. In particular: How can I reference images attached to a post and how can I get all the goodness (like thumbnail generation) that I could get from using them in a template. I would like to have a post like "text paragraph, row of images, text paragraph, big image" etc., where each image links to a bigger version. Is that achievable with standard Lektor tools? – tgpfeiffer Nov 07 '16 at 01:09

2 Answers2

4

Most of the time in the admin site, you want to embed a file listed on the "Attachments" list on the left. To do that, simply use the attachment filename, as in :

![alt text](myimage.png)
orzel
  • 322
  • 2
  • 7
2

Use the standard markdown for the inserting images. For the image named my-image.jpg stored in the assets/static/ use the following markdown code:

<!-- 1) Inserts an image with an empty alt parameter, but better to use the 2nd or the 3rd example -->
![](/static/my-image.jpg)

<!-- 2) Inserts an image also with the text "fancy picture" as the alt parameter value -->    
![fancy picture](/static/my-image.jpg)


<!-- 3) Image also has the title attribute -->    
![fancy picture](/static/my-image.jpg "Title of the fancy picture")

The snippet above will generate resulting HTML:

<img src="../static/my-image.jpg" alt="">
<img src="../static/my-image.jpg" alt="fancy picture">
<img src="../static/my-image.jpg" alt="fancy picture" title="Title of the fancy picture">

I tested this snippet on my example website and it works perfectly.
Please note the / before static in the markdown code.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
user5265
  • 21
  • 4