Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How to get rid of additional <p> when displaying markdown img tags?

Started by Muut Archive 10 years ago · 2 replies · 389 views
10 years ago

Not sure if this is a glitch but when grav renders - ![Test Image ]( /images/testimage. jpg) the resulting html is
<p>
<img src="/images/testimage.jpg" alt="Test Image">
</p>
NOT the expected - <img src="/images/testimage.jpg" alt="Test Image">

How can I get markdown to just render img tag?

10 years ago

You could find the image tag in the string with twig and then replace what is before and after, but if you search on the gitter channel i know that @OleVik has posted something about this

10 years ago

That's really a limitation of how markdown works. You can add a class and float the image left or right and it will overflow out of the <p> tag and render as expected.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1368 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago