Skip to main content

Module link_preview

Module link_preview 

Source
Expand description

The preview of a web page a note links to: a card under the note with the picture the page is shared with, the site it is on, its title and a few words about it. A click opens the page.

The card is as tall for one page as for another, and as tall while the page is being asked as when it has answered: a row doesn’t change height because a preview arrived, or its picture did. A page with nothing to say for itself gets no card, and the room kept for one is given back.

A link that answered as a video is no page: its card offers to play it, and pressed, gives way to the video (see video_box).

Constants§

PREVIEW_DESCRIPTION_LINES 🔒
How many lines of a page’s description the card shows.
PREVIEW_DIM 🔒
How much dimmer than the text the site and the description are.
PREVIEW_PADDING 🔒
The room between the card’s edge and what it says, and between the lines it says it in.
PREVIEW_SPACING 🔒

Functions§

cut_line 🔒
One line of the card, cut where the card ends rather than wrapped.
link_preview
The preview of the page at url, for under the note that links to it: the card, once the page has said what it is; the room the card will take, until then; and nothing, if the page has nothing to say.
link_preview_height
How tall the preview of a link is in a row set in sizes, whatever the page says: the site, the title and the lines of description, and the room around them.
video_offer 🔒
The card of a link that turned out to be a video: as tall as any preview, saying what it is and where, and playing it when it is pressed.