pub struct MediaMark {
pub kind: MediaKind,
pub destination: String,
pub sources: Vec<MediaSource>,
pub alt: String,
pub poster: String,
pub rows: usize,
}Expand description
The destination and label a block-level media placeholder row carries, so a
capable frontend can resolve and paint the real thing. Plain strings (no
source offsets), so they survive the row shuffling of BlockCache reuse
and build_spliced untouched — see VRow::media.
Fields§
§kind: MediaKindWhether this is a picture, a movie, or a sound — which widget the frontend builds over the reserved rows.
destination: StringThe media’s link destination — a path, URL, or data: URI, verbatim from
the AST. A frontend resolves a relative path against the document’s
directory itself; core holds no I/O.
Empty is possible and legal for a <video>/<audio>, which may carry no
src of its own and name its candidates in child <source>s instead —
unlike an <img>, whose src is the picture. A frontend with an empty
destination takes its URL from sources.
sources: Vec<MediaSource>A <picture>’s theme/media alternatives, in document order, when this
block image came from one; empty for a plain  / bare <img>. Each
is a <source>’s media query + candidate URL(s); a frontend that knows its
theme picks the first whose media matches and falls back to destination
(the <img>). Core keeps them verbatim and picks nothing — it has no theme.
alt: StringThe media’s alt text (its rendered inline children, flattened), or empty
when it has none. Also what the placeholder label shows. For a <video>/
<audio> this is the element’s own text content — the “your browser does
not support…” fallback, which doubles as its accessible name.
poster: StringA <video poster="…">’s still frame, verbatim, or empty when there is
none (and always empty for an image or audio). It is an image
destination, so a frontend already able to draw a picture can show it
before the movie loads — or in place of one it can’t play at all.
rows: usizeHow many visual rows this media reserves — the placeholder label row plus
the blank filler rows below it, so a frontend that paints a real raster has
the vertical room to draw it. 1 is the bare placeholder (a frontend that
can’t draw pictures, or an image it couldn’t resolve). A terminal frontend
asks for as many rows as the fitted picture is tall; the pixel-laid-out GUI
ignores this and sets its own row height, so it always leaves it 1. The
count comes from the frontend (via crate::Doc::set_media_rows) because
core does no I/O and can’t measure the image itself. See [VRow::image].