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

Add dimension support for images #543

Closed
SchrodingersGat opened this issue May 23, 2023 · 4 comments
Closed

Add dimension support for images #543

SchrodingersGat opened this issue May 23, 2023 · 4 comments

Comments

@SchrodingersGat
Copy link

SchrodingersGat commented May 23, 2023

Is your feature request related to a problem? Please describe.

It would be useful to be able to specify the size (height / width) of images within the markdown.

Describe the solution you'd like

The ability to specify width / height within the markdown tags. wiki.js offers this feature in their markdown editor:

image

Describe alternatives you've considered

You can use <img> tags but in some systems raw html tags are stripped for security reasons and prevents this approach.

@Ionaru
Copy link
Owner

Ionaru commented May 26, 2023

It looks like the wiki.js markdown renderer supports this from itself, it isn't standard as far as I know.

Using the previewRender option it is possible to use any custom markdown renderer that is available. Including ones that support image sizes. If wiki.js exports its markdown renderer, then you can use that.

Alternatively you can use plain HTML for images and specify a size like this:

<img src="https://placekitten.com/g/500/500" width="50px" height="50px">

I think it will be a good idea to support multiple markdown renderers out-of-the-box, but that would require significant work and I would rather include that in #447.

@SchrodingersGat
Copy link
Author

SchrodingersGat commented May 26, 2023

It looks like the wiki.js markdown renderer supports this from itself, it isn't standard as far as I know.

I'm not expecting it to be standard, but it is a nice feature :)

Alternatively you can use plain HTML for images and specify a size like this:

The system I am implementing in sanitizes HTML tags in uploaded data, which is why I'm looking for an alternative!

Would you consider adding this rendering feature, or be open to a PR?

@Ionaru
Copy link
Owner

Ionaru commented May 28, 2023

Would you consider adding this rendering feature, or be open to a PR?

No, the editor should never change the way markdown is displayed by default. Any developer can change options for their use-case using the previewRender or renderingConfig.markedOptions options, but any specific syntax or rendering changes will vendor-lock people to easymde or a specific markdown renderer which defeats the purpose of the editor.

EasyMDE is a markdown editor with a preview function to help with editing, not a markdown renderer, markdown parser or markdown displayer.

@SchrodingersGat
Copy link
Author

@Ionaru understood, I'll close this out then :)

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

No branches or pull requests

2 participants