Content: Images wrapped in <p> tags

Created on 31 May 2020  路  7Comments  路  Source: nuxt/content

Version

@nuxt/content: v1.2.0
nuxt: v2.12.0

Reproduction Link

https://codesandbox.io/s/nuxtcontent-demo-pfror?file=/content/index.md

Steps to reproduce

Any markdown with an image
` ![](https://cdn-images-1.medium.com/max/1280/1*tBJ7iUluy2Yhobd6qGUKQA.png)

What is Expected?

I would not expect markdown images to be wrapped in paragraph tags

What is actually happening?

Markdown images are wrapped in

tags.

bug

Most helpful comment

This is an aspect of Markdown, not nuxt/content. Content uses remark plugins to process Markdown text - it looks like there's a plugin called remark-unwrap-images that does exactly what you're looking for.

Here's the whole list of remark plugins, for reference. And here's the Configuration page of the nuxt/content documentation on how to enable them.

All 7 comments

This is an aspect of Markdown, not nuxt/content. Content uses remark plugins to process Markdown text - it looks like there's a plugin called remark-unwrap-images that does exactly what you're looking for.

Here's the whole list of remark plugins, for reference. And here's the Configuration page of the nuxt/content documentation on how to enable them.

Thanks @thely

For reference on adding remark plugins

yarn add remark-unwrap-images or npm i remark-unwrap-images

And then add this to your nuxt.config.js

content: {
  markdown: {
    plugins: ['remark-unwrap-images']
  }
},

Does this work? I'm using the remark-unwrap-images plugin and my img tag is still wrapped in a p tag.

@shash7 yeah it's working for me

Strange. Its not working for me.

@shash7 , what version of nuxt/content are you using? Support for Remark plugins was only added in 1.2.0, which came out last week.

I'm using 1.0.0
Guess that explains the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pi0 picture pi0  路  3Comments

LukaszRados picture LukaszRados  路  3Comments

dolbex picture dolbex  路  3Comments

adrianschubek picture adrianschubek  路  4Comments

davestewart picture davestewart  路  3Comments