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

Long shortcodes / How to best insert images from markdown #2476

Open
druskus20 opened this issue Apr 18, 2024 · 0 comments
Open

Long shortcodes / How to best insert images from markdown #2476

druskus20 opened this issue Apr 18, 2024 · 0 comments

Comments

@druskus20
Copy link

druskus20 commented Apr 18, 2024

Documentation issue

Summary

What's the best way to insert images from markdown.
I would like to be able to specify: width, height. alt text, and op.

This is suggested on the docs:

{% set resized = resize_image(format="jpg", path=page.colocated_path ~ img_name, width=width, op="fit_width") %}
<img alt="{{ alt }}" src="{{ resized.url | safe }}" />

However, to the best of my knowledge this does not allow for default parameters and it becomes verbose.
Creating different shortcodes for combinations of these parameters become cumbersome.

For example, we could create:

  • image
  • image_alt: alt text
  • sized_image: width, height
  • sized_image_alt: width, height and alt

But this does not scale well 4 shortcodes is already a bit too much.

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

1 participant