Closed pszafer closed 5 years ago
Hi, you could try this Gatsby remark plug-in: https://github.com/premieroctet/gatsby-remark-images-zoom. I'm not sure if it works with MDX though.
I haven't implemented zoom myself. Given that there seems to be a plugin that solves this (thanks @JulesBlm) and that this isn't a gatsby-mdx issue I'm going to close it.
You could probably achieve this by taking control of the rendering of gatsby-remark-image's output using MDXProvider (the remark output can look like this https://github.com/gatsbyjs/gatsby/blob/86ee22e6a5cd57ef566f1a427e94e35e33f0fa99/packages/gatsby-remark-images/src/index.js#L196-L216) and you can override picture
, source
, or img
using MDXProvider
.
@JulesBlm medium-zoom is not working with picture tags properly. It is only working with <img>
.
@ChristopherBiscardi is it possible with MdxProvider to extract <picture>
/ <span>
from <p>
element?
@pszafer I'm not sure what you mean by extract. You can take control of any renderable element via MDXProvider
. Check the docs here: https://mdxjs.com/advanced/components#mdxprovider
I ended up doing my modal as gatsby plugin, so this is no problem for me anymore https://github.com/pszafer/gatsby-remark-images-modal
But what I meant is that by default <picture>
is put in <p>
like this:
<p>
<span ...>
<picture>...</picture>
</span>
</p>
I wanted to extract it from <p>
so I can put <div>
and other DOM elements there.
Hi, I'm trying to add zoom-in/zoom-out feature to my images. I'm configuring gatsby as:
My attempts:
<picture>
element support<MDXProvider components={components}>
and then implement this https://popmotion.io/pose/learn/react-tutorial-medium-style-image-zoom/ but this puts
<div>
inside<p>
, so many HTML warnings occured and actually some failed to render it.<picture>
and it seems unecessaryDo you know any good example or how to do it properly (gatsby way) if I want use features of
gatsby-remark-images
and addzoom
feature?