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/?
Asked
Active
Viewed 1,097 times
2
-
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 Answers
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 :


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

<!-- 2) Inserts an image also with the text "fancy picture" as the alt parameter value -->

<!-- 3) Image also has the title attribute -->

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.