Positioning and scaling images in markdown

178 views
Skip to first unread message

Graham Wheeler

unread,
May 13, 2015, 2:20:54 AM5/13/15
to nikola-...@googlegroups.com
Hi all

I am attempting to convert my site from Pelican to Nikola, and one of the issues I am having is with images. Here is a typical way in which I would include an image in Pelican in my markdown:

    [![Archimedes Thoughtful by Fetti (1620)](/images/archimedes_thumb.png "Archimedes Thoughtful by Fetti (1620)")](/images/archimedes.png){: style="float:right;width:35%;margin:10px"}

The first part specifies the thumbnail, full-size image, hover text etc. The part at the end in {} is CSS styling for the image.

What would the equivalent be in Nikola?

Thanks!
-g

Roberto Alsina

unread,
May 13, 2015, 7:48:41 AM5/13/15
to nikola-...@googlegroups.com

Since Nikola and Pelícan use the same Markdown implementation by default, I  expect that would work.

If it doesn't please share the error/problem.

--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Graham Wheeler

unread,
May 13, 2015, 11:12:16 AM5/13/15
to nikola-...@googlegroups.com, ral...@kde.org
This is what I see in the generated HTML:

<p><a href="../images/archimedes.png"><img alt="Archimedes Thoughtful by Fetti
(1620)" src="../images/archimedes_thumb.png" title="Archimedes Thoughtful by Fetti (1620)"></a>{: style="float:right;width:35%;margin:10px"}</p>

As you can see, the CSS just gets inserted as content.

Roberto Alsina

unread,
May 13, 2015, 11:15:34 AM5/13/15
to nikola-...@googlegroups.com
On Wed, May 13, 2015 at 12:12 PM, Graham Wheeler <gr...@geekraver.com> wrote:
This is what I see in the generated HTML:

<p><a href="../images/archimedes.png"><img alt="Archimedes Thoughtful by Fetti
(1620)" src="../images/archimedes_thumb.png" title="Archimedes Thoughtful by Fetti (1620)"></a>{: style="float:right;width:35%;margin:10px"}</p>

As you can see, the CSS just gets inserted as content.


AFAICS that's what markdown does. Maybe this is some pelican-specific markdown extension... is it documented anywhere?

Chris Warrick

unread,
May 13, 2015, 11:20:43 AM5/13/15
to Nikola—Discuss
On Wed, May 13, 2015 at 5:12 PM, Graham Wheeler <gr...@geekraver.com> wrote:
> This is what I see in the generated HTML:
>
> <p><a href="../images/archimedes.png"><img alt="Archimedes Thoughtful by
> Fetti
> (1620)" src="../images/archimedes_thumb.png" title="Archimedes Thoughtful by
> Fetti (1620)"></a>{: style="float:right;width:35%;margin:10px"}</p>
>
> As you can see, the CSS just gets inserted as content.

It looks like you have the 'extra' Markdown extension enabled in
Pelican (they do that by default). You should enable it on your
Nikola site via the MARKDOWN_EXTENSIONS setting in Nikola’s config.

MARKDOWN_EXTENSIONS = ['fenced_code', 'codehilite', 'extra']

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Graham Wheeler

unread,
May 13, 2015, 11:36:20 AM5/13/15
to nikola-...@googlegroups.com
I dug a bit further and found this is 'kramdown' syntax but is not something I specifically enabled
in Pelican so it must be the default. Following your suggestion works Chris, thanks!

Roberto Alsina

unread,
May 13, 2015, 12:07:58 PM5/13/15
to nikola-...@googlegroups.com
Should we enable that one for new sites?
 

Chris Warrick

unread,
May 13, 2015, 12:11:19 PM5/13/15
to Nikola—Discuss
+1

Roberto Alsina

unread,
May 13, 2015, 1:23:04 PM5/13/15
to nikola-...@googlegroups.com
Done for new sites, added reminder to add it to real default for v8

Rasi ras

unread,
Apr 24, 2019, 10:16:42 PM4/24/19
to nikola-discuss


Reply all
Reply to author
Forward
0 new messages