Bud P. Bruegger
Bud P. Bruegger

Reputation: 1091

How can I insert images in lektor markdown sections?

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/?

Upvotes: 2

Views: 1220

Answers (2)

user5265
user5265

Reputation: 21

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.

Upvotes: 2

orzel
orzel

Reputation: 332

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)

Upvotes: 4

Related Questions