Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't add width param to image url, or make it configurable. #29

Open
llibdude opened this issue Aug 19, 2022 · 2 comments
Open

Don't add width param to image url, or make it configurable. #29

llibdude opened this issue Aug 19, 2022 · 2 comments

Comments

@llibdude
Copy link

When uploading an image to markdown, the plugin adds ?w=450 to the end of the url. My content creators then need to manually strip that url param. In my case, if the width exists in the url, and in my site if I use that url in next/image, next/image will pull the 450 width version of the image, then scale it up to render it how i want. This creates very low resolution images.

I believe this the offending code https://github.com/sanity-io/sanity-plugin-markdown/blob/main/src/components/Editor.jsx#L60

Is it's purpose to render nicely in the preview? I would prefer it totally removed or at least allow configuration so that I can unset it.

In the meantime I am stripping this url param on my app side, which isn't the end of the world but not idea.

Thanks!

@angelinekwan
Copy link

Point up for this to be configurable

@ruchernchong
Copy link

You are able to do it with the following options now:

defineField({
  type: 'markdown',
  name: 'markdown',
  title: 'Markdown',
  options: {
    imageUrl: imageAsset => imageAsset.url
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants