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 support for image sizing via titles in markdown #398

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Feb 3, 2025

Introduced a feature to parse width and height from image titles using a regex pattern. Updated the markdown parser, tests, and docs to support and demonstrate inline image resizing with syntax like =WxH or =W. If height is omitted, it defaults to the width value.

See also the updated docs: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/398/syntax/images.html#inline-images

Introduced a feature to parse width and height from image titles using a regex pattern. Updated the markdown parser, tests, and docs to support and demonstrate inline image resizing with syntax like `=WxH` or `=W`. If height is omitted, it defaults to the width value.
@Mpdreamz Mpdreamz requested a review from reakaleek February 3, 2025 15:00
@reakaleek
Copy link
Member

reakaleek commented Feb 3, 2025

A common use case I often see is using 100% on mobile screen sizes and 50% or large screen sizes.

I know that this is currently not supported. But I'm thinking, what if we want this in the future? How would the syntax look like then?

@Mpdreamz
Copy link
Member Author

Mpdreamz commented Feb 3, 2025

img.png "title =50%,100%"

If we roll with the default breakpoints:

sm 40rem (640px) @media (width >= 40rem) { ... }
md 48rem (768px) @media (width >= 48rem) { ... }
lg 64rem (1024px) @media (width >= 64rem) { ... }
xl 80rem (1280px) @media (width >= 80rem) { ... }
2xl 96rem (1536px) @media (width >= 96rem) { ... }

The syntax would apply too: large (lg,2xl,2xl), small (md, sm)

wdyt?

@reakaleek
Copy link
Member

img.png "title =50%,100%"

If we roll with the default breakpoints:

sm 40rem (640px) @media (width >= 40rem) { ... }
md 48rem (768px) @media (width >= 48rem) { ... }
lg 64rem (1024px) @media (width >= 64rem) { ... }
xl 80rem (1280px) @media (width >= 80rem) { ... }
2xl 96rem (1536px) @media (width >= 96rem) { ... }
The syntax would apply too: large (lg,2xl,2xl), small (md, sm)

wdyt?

Can you elaborate how the syntax would look like?

I don't understand how it would look like in the following exampe.

![alt](img.png "title =50%")

@Mpdreamz
Copy link
Member Author

Mpdreamz commented Feb 4, 2025

![50% large screens, 100% small screens](img.png "title =50%,100%")
![pixel sizes for large and small](img.png "title =250x500,125x250")
![50% width and height for all media](img.png "title =50%")

@reakaleek
Copy link
Member

![50% large screens, 100% small screens](img.png "title =50%,100%")
![pixel sizes for large and small](img.png "title =250x500,125x250")
![50% width and height for all media](img.png "title =50%")

Cool, thank you for the clarification!

@Mpdreamz Mpdreamz merged commit 250d161 into main Feb 4, 2025
6 checks passed
@Mpdreamz Mpdreamz deleted the feature/inline-image-resize branch February 4, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants