-
Notifications
You must be signed in to change notification settings - Fork 32
Automatically use alt text as title for images when no title is provided #1656
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
Conversation
🔍 Preview links for changed docs |
Mpdreamz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great QoL improvement 👍
|
@Mpdreamz Looks like it's not working as intended. Looking at it. |
|
@Mpdreamz @reakaleek To make things simpler, I've made it so that Alt text always overrides the title, whether it's present or not. In most cases, the titles we have are not useful. |
|
This is already super great! Is it possible to also check if the current title is plain "title" and in that case overwrite it with the alt value too? :D This could also be something we instead flag with a linter for example, if we don't want to bake it in docs-builder :) Edit: nevermind, just saw your last comment @theletterf :D Perfect |
florent-leborgne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is greatttt
…om:elastic/docs-builder into theletterf-alt-images-title-redundancy-fix
Mpdreamz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #1655
When adding images to documentation, users often need to specify sizing parameters (e.g.,
=50%) in the title attribute. This creates a redundancy issue where the alt text needs to be duplicated as the title before adding the size parameters, resulting in Markdown like:This PR modifies the
ImageBlockclass to automatically use the alt text as the title value when no explicit title is provided. This allows users to:Skip the redundant title text when only specifying size parameters:
Not have to duplicate information when using image directives.
Changes
FinalizeAndValidatemethod inImageBlock.csto use alt text as the title when title is not specified