-
-
Notifications
You must be signed in to change notification settings - Fork 21
Don't remove stars from alt attribute of an image #44
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
Comments
It comes from this line in the spec
https://spec.commonmark.org/0.31.2/#example-575 And is because alt is intended for screen readers and extra symbols are for sighted users and are handled inconsistency (at best) by screen readers, traditionally asterisk are ignored by screen readers and should not be included in text or alt text intended to be consumed by a reader. |
Thank you for the clarification, @ChristianMurphy, that makes sense in the context of accessibility and screen readers. I got the rationale. However, I still find the decision to strip only the asterisk ( Looking at the Still, this feels overly prescriptive. Users might initially include asterisks in image descriptions for inline markdown parsing, but upon seeing that the asterisks are rendered literally in the fallback alt text when the image fails to load (or read aloud awkwardly by screen readers), they would naturally adjust their behavior and remove them theirselves. Over time, such feedback would discourage misuse organically, without needing to enforce this restriction at the parser level. In my view, this behavior limits flexibility. I suspect it stems from the desire to avoid the formatting complexity already present in link labels, and that rationale was extended, according to me unnecessarily, to image descriptions. Anyway, I got it and nothing to do since the commonmark spec is as it is. My main question: why curly braces |
If you disagree with the approach, commonmark has a discussion forum where you could share your thoughts with the spec team https://talk.commonmark.org/
Yeah if you want to discuss more, that is specific to
|
Thanks @ChristianMurphy, I will continue with https://talk.commonmark.org/ and
Regarding
|
Initial checklist
Affected package
mdast-util-from-markdown
Steps to reproduce
Actual behavior
It removes the stars from "alt", keeps stars in "title"
Expected behavior
It should keep stars in "alt" as well.
But, I see that commonmark specs also removes stars from "alt". I couldn't get the rationale of removing stars from "alt", whileas doesn't remove stars from "title". It would be better to keep stars in "alt", so I would use it as a directive for images for transformation in a plugin.
I know, you will close the issue pointing commonmark specs. I just wanted to know the rationale in commonmark specs?
(why I opened this issue is because the next question will be why curly braces are also removed from "alt" attribute of an image when
remark-mdx
parse it; at least I would expect curly braces are kept in "alt" whenremark-mdx
parse it since commonmark specs also keeps the curly braces in alt attribute. This issue is critic for me because of this discussion)Runtime
node@latest
Package manager
npm@latest
Operating system
macos@latest
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: