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

How to make img alt information available in JF2 #46

Open
barnabywalters opened this issue Nov 4, 2022 · 0 comments
Open

How to make img alt information available in JF2 #46

barnabywalters opened this issue Nov 4, 2022 · 0 comments

Comments

@barnabywalters
Copy link
Member

The current mf2 parsing spec makes alt information available on properties which have been parsed from image elements:

<img class="u-photo" src="/photo.jpg" alt="a photo" />
"photo": {
  "value": "/photo.jpg",
  "alt": "a photo"
}

Currently, this information is lost on conversion from mf2 to jf2.

Potential solutions which come to mind:

  • Provide img+alt structures where alt information is available, forcing consumers to check whether every image-based property is a string or img+alt array before consuming (breaks existing code)
  • Provide img+alt structures by default on every property which is parsed as an image, with empty alt values if none is found. Breaks existing code but is more consistent.
  • Use either the ref(erences) list or a new “alts” list on jf2 objects to provide the alt value, indexed by the image URL. This would not break any existing code afaik

Originally noted at aaronpk/XRay#112

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

No branches or pull requests

1 participant