getgrav / grav-plugin-admin

Grav Admin Plugin
http://getgrav.org
MIT License
355 stars 227 forks source link

Content is wrapped inside a p #183

Closed jpfleury closed 8 years ago

jpfleury commented 9 years ago

Config: Grav v0.9.43 and Admin Panel v.0.6.0

When adding image@3x.jpg in the Page Media and inserting it, the Markdown code added is:

![](image.jpg)

The HTML result is invalid (paragraph inside paragraph):

<p><p><img style="" src="/grav/images/4/...-image3x.jpeg" srcset="/grav/images/4/...-image3x.jpeg 682w, /grav/images/1/...-image3x.jpeg 2048w, /grav/images/f/...-image3x.jpeg 1365w" sizes="100vw" /></p></p>
flaviocopes commented 9 years ago

Strange, I'm just getting a <p><img.... Does the same happen on the admin-side page preview?

jpfleury commented 9 years ago

I found the problem. It has nothing to do with images. It's just that I was testing with pages containing only an image.

The problem is that the entire content is wrapped inside a p. Example:

    <div class="list-blog-padding">

            <p><p>Paragraph 1</p>
<p>Here's an image: <img style="" src="/grav/images/f/...-image3x.jpeg" srcset="/grav/images/f/...-image3x.jpeg 250w, /grav/images/1/...-image3x.jpeg 750w, /grav/images/e/...-image3x.jpeg 500w" sizes="100vw" /></p>
<p>Another paragraph</p></p>

        <p class="prev-next">

                            <a class="button" href="/grav/blog/article">Previous Post <i class="fa fa-chevron-right"></i></a>
                    </p>

    </div>

See, we have:

<p>
    <p>Paragraph 1</p>
    <p>Here's an image: <img ... /></p>
    <p>Another paragraph</p>
</p>
flaviocopes commented 9 years ago

Which theme are you using?

jpfleury commented 9 years ago

Antimatter (from the blog skeleton).

flaviocopes commented 9 years ago

Right so in the Antimatter theme (and also checked Bootstrap, it's the same) we wrap {{ page.content }} in a p tag. @rhukster do you recall the reason for it? All other {{ page.content }} mentions in other templates are not wrapped in a paragraph. I tried removing, all seems fine. Can we drop the p wrap?

rhukster commented 9 years ago

I can see no reason for having that

tag, yes i think we can remove it.