Content Hint
Name
http://lynx-json.org/content
Meaning
A content hint describes a value that contains or references content that is to be considered a part of the containing representation (embedded).
Related Hints
None
Synonyms
None
Format Rules
If the value is present, it must comply with the following rules:
- MUST be an object.
- MAY have an
srcproperty for remote content or adataproperty for inline content. - SHOULD have an
altproperty for alternate text to be displayed if the content cannot be displayed or if the user cannot view it. - MAY have a
scopeproperty whose value specifies the content realm or URL intended for display. If present, the value MUST be a valid URI. - MAY have a
relproperty whose value specifies the relationship between the document containing the content and the destination resource, as described in RFC 5988. - MAY contain a
mediaproperty whose value specifies the intended media target of the content. If present, the value MAY be one of the following:screen,print, or a qualified name (absolute URI); otherwise, its value MUST be presumed to bescreen. - MAY contain a
sourcesproperty whose value specifies an array of preferred alternativecontentvalues ordered from more preferred to less preferred. - MUST NOT contain any other properties that are described by a specification.
- MAY contain other properties that are not described by a specification.
src present
If the value has an src property:
srcMUST be a valid URI ornull.- MAY have a
typeproperty whose value must be a valid media type name to indicate the expected media type of the content. - MUST NOT have
dataorencodingproperties.
data present
If the value has a data property:
- MUST have a
typeproperty whose value must be a valid media type name to indicate the media type of the content encoded in thedataproperty. - if
typeisapplication/jsonor a variant ofapplication/json,dataMAY be an object or an array; otherwise,dataMUST be a string representing the content to be embedded. - if
typeisapplication/lynx+json, and the embedded content does not have its ownbasevalue, the value ofbaseMUST be copied from the containing document. - if
datais a string, MAY have anencodingproperty whose value MUST beutf-8orbase64. If not present, theencodingisutf-8. - MUST NOT have an
srcproperty.
Examples
src present
{
"src": "http://www.example.com/fletch-movie-review.pdf",
"alt": "Movie Review of Fletch",
"spec": {
"hints": [ "content" ]
}
}
data present
UTF-8 String
{
"data": "# Review of Fletch\n##Pros\n\nToo many to list.\n##Cons\n\nNone!",
"type": "text/markdown",
"alt": "Movie Review of Fletch",
"spec": {
"hints": [ "content" ]
}
}
Base64 String
{
"data": "WW91IHRhbGtpbmcgdG8gbWU/IC0tIFRheGkgRHJpdmVy",
"encoding": "base64",
"type": "text/plain",
"alt": "Movie Quote",
"spec": {
"hints": [ "content" ]
}
}
JSON Content
{
"data": {
"base": "http://example.com/",
"realm": "http://example.com/movie-quotes/",
"value": [
"There's no crying in baseball! -- Tom Hanks, A League of Their Own",
"Mrs. Robinson, you're trying to seduce me. Aren't you? -- Dustin Hoffman, The Graduate",
"Donny you're out of your element! -- John Goodman, The Big Lebowski"
],
"spec": {
"hints": [ "list", "container" ],
"children": {
"hints": [ "text" ]
}
}
},
"type": "application/lynx+json",
"spec": {
"hints": [ "content" ]
}
}
Alternate Sources
{
"data": "There's no crying in baseball! -- Tom Hanks, A League of Their Own",
"type": "text/plain",
"sources": [
{
"src": "./no-crying.mp4",
"type": "video/mp4",
"alt": "Video Clip: There's no crying in baseball!",
"spec": {
"hints": [ "content" ]
}
},
{
"src": "./no-crying.mov",
"type": "video/quicktime",
"alt": "Video Clip: There's no crying in baseball!",
"spec": {
"hints": [ "content" ]
}
}
],
"spec": {
"hints": [ "content" ]
}
}
With Media
{
"src": "./receipt.lnx",
"type": "application/lynx+json",
"media": "screen",
"sources": [
{
"src": "./receipt.pdf",
"type": "application/pdf",
"media": "print",
"spec": {
"hints": [ "content" ]
}
}
],
"spec": {
"hints": [ "content" ]
}
}
Authoring Rules
None
Authoring Considerations
None
User Agent Rules
- If the user agent is unable to display the content, it MUST display a link to the content, with the text of the
altproperty, if present. - If the type of the content is not in the range
text/*, then the user agent SHOULD consider the value of thealtproperty to be the text content for the value.
Input
If the specification describing the value has an input property, the user agent MUST provide the user with a control to supply the content.
User Agent Considerations
- The user agent must anticipate that a value described by a
contenthint may contain no visible content. - If a value described by a
contenthint contains asourcesproperty, the user agent should display the content from thesourcesproperty value most closely matching its goals. To do so, the user agent should evaluate the available alternatives in order based ontype,hints,media, and any other characteristics (imagewidth,height, andscale, for example). If the user agent cannot display any of the preferred alternatives from thesourcesproperty value, the user agent should display the value described by acontenthint.