indieweb / indieweb/jf2

How to make img alt information available in JF2

Open
#46 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
12
Forks
4
PR merge metrics
No merged PRs in 30d

Description

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

```html
a photo
```

```json
"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 https://github.com/aaronpk/XRay/issues/112

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the mf2 parsing behavior described in the issue and the JF2 conversion that currently drops the alt value. Read the linked XRay issue for related context, then compare the three proposed representations and decide how alt information should be preserved without losing compatibility. Done means the chosen JF2 representation retains image alt information and its compatibility impact is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.