Search code examples
pythonmarkdownrestructuredtextpelican

Syntax to put images in .rst


I'm confused on the markdown syntax works to put images in pelican.

When I have this, everything works.

.. image:: /images/Rugby-Tackle.jpg
    :alt: About to make the tackle, Yale Alumni Game 2017

But I dug this up on the .rst documentation. The pelican docs have many references to code like this:

[![Alt Text]({filename}/images/Rugby-Tackle.jpg)]({filename}/images/Rugby-Tackle.jpg)

or this:

![Alt Text]({filename}/images/Rugby-Tackle.jpg)

All of which just show up as text when included in the markdown file and don't produce an image. What am I missing here?


Solution

  • Pelican supports both Markdown and ReStructuredText documents. Markdown documents use the .md file extension and ReStructuredText documents use the .rst file extension. If you are using .rst files, then only ReStructuredText syntax will work. If you want to use Markdown syntax, then you need to use Markdown files with the appropriate file extension (.md).

    You cannot mix Markdown and ReStructuredText syntax in the same document. That may not be immediately obvious if you are using simple formatting as some of the basics (like paragraphs) work the same in both. However, any syntax which differs will not be understood. Markdown knows nothing about ReStructuredText syntax and ReStructuredText knows nothing about Markdown syntax.