Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-079

Links in view are looked up in bounded batches

When a link with a navigation request scrolls into view, the extension SHALL ask the host once for the target of its request, in previewLinkDiscover messages of at most 64 requests, and the host answers with previewLinkTargets that lists, for each request in order, its kind and its path or reason; the host accepts a previewLinkDiscover message only when its requests are an array of at most 64 strings of at most 4096 characters each.

Step 1 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-011: from “A link comes into view” to “The target of the link is known”.

Scenarios 12

The situations the tests check; open one to read it.

nominalLink scrolls in
Givena long document with a link below the fold
Whenthe link intersects the viewport
Thenits request is sent once in a previewLinkDiscover message and the link is no longer observed
boundarySame request twice
Giventwo links with the same request
Whenboth come into view
Thenthe request is sent once
boundaryBatches of at most 64
Requests waitingOutcome
130 distinct requests in viewthree messages carry 64, 64 and 2 requests
three requestsone message carries three requests
refusalRequests that are not looked up
Link request or pageOutcome
#sectionno previewLinkDiscover is sent for it
okf-link:...no previewLinkDiscover is sent for it
https://x and http://xno previewLinkDiscover is sent for them
mailto:a@bno previewLinkDiscover is sent for it
other.md (relative link)its request is sent when it comes into view
a page whose window has no IntersectionObserverno discovery message is sent and clicks still reach the host (see SwRS-MDOKFSTUDIO-TOOLBAR-077)
a page with the observer, a link that intersectsits request is sent
boundarySearch by name
GivenOutcome
a target named in a request that exists only below node_modules, .git, _build, .venv or venvnot found
a target hidden by the files.exclude settingfound
a name matching more than 50 files under one rootthe search stops at 50 files; the answer may differ from the full set
boundaryContent replaced
InputOutcome
The page content is replaced and the rescan finds new linksThe new links are observed; a link still in the content is not observed twice
Links of the old content are gone from the pageThe observer releases them, so they are not kept alive
nominalThe host answers each request
Givenrequests for an existing file, a missing file and a javascript: link
Whenthe host answers
ThenpreviewLinkTargets lists a local target with the real path and two blocked targets with their reasons, in the order of the requests
refusalNo answer for another render
GivenOutcome
a discovery of an older request id, or of another document or revision than the host's renderno previewLinkTargets is sent
a discovery in flight when a new render is shownno answer is sent when the resolution ends
refusalA failed discovery
GivenOutcome
a request whose resolution raises an errorthe warning "Preview link discovery failed: {error}" is shown and nothing is answered for the batch
a preview closed meanwhile, when the error is raisedno warning is shown
nominalLinks are asked again when the reader returns
GivenWhenThen
a link already looked up and a file created or deleted sincethe preview window regains focus or the preview becomes visible againthe requests of the links in view are sent again and the tooltip and the warning icon follow the answer
nominalRequests within the bounds
InputOutcome
64 requests of 4096 charactersthe message is accepted (the limit)
an empty arrayaccepted
refusalRequests over the bounds or of the wrong kind
InputOutcome
65 requestsrefused
a request of 4097 charactersrefused
a number among the requestsrefused
a value that is not an arrayrefused

Implemented in 3

Tested by 5

Known limits (2)

Replaces

SwRS-MDOKFSTUDIO-TOOLBAR-083The host accepts discovery messages of bounded size superseded superseded by SwRS-MDOKFSTUDIO-TOOLBAR-079 Markdown file