Expand description
What a note says, taken apart for showing: plain text, links, mentions of people, hashtags, the images and the videos it carries, the notes it quotes, and the web page it is shown a preview of.
Images, videos and quoted notes are set aside from the text: what stands for them in it is an address, and they are shown under it for what they are.
What a link is is told by how its address ends, and by what the note
says of it in a NIP-92 imeta tag (see Attachment): a link the note
calls a video is one, whatever its address looks like. A link to a
YouTube video is a video too (see crate::youtube), though what is
at its address is a page.
The text is split by nostr’s own parser, so what counts as a URL, a
nostr: URI or a hashtag is what the rest of the ecosystem agrees on.
Before that, what the note marks as Markdown is taken for what it is
(see markdown): the text comes here as runs, each in one style,
and each run is read for its links, mentions and hashtags. A note that
marks nothing is one run, and is read as it always was.
Structs§
- Attachment
- What a note says of something it links to, in a NIP-92
imetatag:["imeta", "url https://…", "m video/mp4", "dim 1920x1080", …]. - Builder 🔒
- Builds a
Content, counting what it shows and stopping at a limit. - Content
- A note’s content, parsed, and cut to what a feed row shows.
- Note
Image - An image a note carries: a link to a picture, shown under the text rather than in it.
- Note
Video - A video a note carries: a link to one, played under the text rather than followed from it.
- Quote
- Another note a note quotes: one it names by its address in the text
(
nostr:note1…,nevent1…). Shown under the text, as the note it is when that is at hand, and as a link to it when it isn’t. - Whole
- The text of a note that was cut, all of it: what its row shows once it is asked for the rest.
Enums§
Constants§
- CODE_
CHARS_ 🔒PER_ FOUR - How many characters of text four of code take the room of: its letters are all as wide as the widest.
- FEED_
NOTE_ MAX_ CHARS - How much of a note a feed row shows, in characters, until it is asked
for the rest. A long note is cut here, and what it says in full is
kept beside what is shown of it (see
Content::whole). - FILE_
EXTENSIONS 🔒 - The file extensions of what is plainly not a web page: nothing with a title to preview it by, and not worth asking.
- IMAGE_
EXTENSIONS 🔒 - The file extensions of the pictures that can be decoded and shown.
- LINK_
LABEL_ 🔒MAX_ CHARS - How long a link’s label may be before it is cut, as in Vega.
- MAX_
NOTE_ 🔒IMAGES - How many of a note’s images a feed row shows.
- MAX_
NOTE_ QUOTES - How many of the notes a note quotes are shown under it.
- MAX_
NOTE_ 🔒VIDEOS - How many of a note’s videos a feed row gives room to.
- MENTION_
CHARS 🔒 - How wide a mention is counted as, when counting what a note shows: about what a name takes, whoever it turns out to be.
- QUOTE_
DEPTH - How many notes deep quoting is shown: a note in a note in the note of a row, and no further. A note quoted deeper than that shows as a link: quoting has no end of its own.
- REFERENCE_
CHARS 🔒 - How many characters of a
note1…/naddr1…stand for the whole of it. - VIDEO_
EXTENSIONS 🔒 - The file extensions of the videos that are played in their row: files of pictures and sound, whatever is in them. Whether this machine can decode one is found out when it is played.
Functions§
- has_
extension 🔒 - Whether the path of
urlends in one ofextensions. - imeta
- What one NIP-92
imetatag says, and of which address.Noneif it is not such a tag, or names no address. - inline
- Every piece of
segmentsthat stands in a line of text: those in the cells of its tables too, each where it stands. - is_
image 🔒 - Whether
urlis a picture this client can fetch and show: anhttpsaddress (nothing else is fetched) whose path ends like a picture’s. - is_
video 🔒 - Whether
urlis a video this client can fetch and play: anhttpsaddress (nothing else is fetched) whose path ends like a video’s, that the note calls one (said), or that is a YouTube video’s. - labelled 🔒
- What stands for a link the note gives a
labelof its own: the label, and after it where the link goes, unless the label says so itself. A label can say anything, and a click on it opens the address: which site that is on is not left to the label. With no label, the address made short, as for any link. - link_
label 🔒 - The text that stands for a link: its host and path, without the scheme,
the query or a leading
www., cut if it is still long. - may_
be_ 🔒page - Whether
urlmay be a web page that can be asked what it says of itself: anhttpsaddress (nothing else is fetched) whose path doesn’t end like a file’s. - named 🔒
- What the
nostr:URIuristands for. - parse
- Parse a note’s
content, cutting its text atmax_charscharacters of what it shows. Of a note that is cut, all of the text is kept as well. - parse_
attached - As
parse, of a note that saysattachedof what it links to. - parse_
dimensions 🔒 - What an
imetatag’sdimfield says:"1920x1080". - parse_
up_ 🔒to content, with at mostmax_charscharacters of its text, and whether there was more.- quote 🔒
- The note
idas one quoted, written byauthorand to be found atrelay, as far as its address says. - short_
reference 🔒 - The first characters of a bech32 address, standing for all of it.