Skip to main content

Module images

Module images 

Source
Expand description

Image references in Markdown. Hammer shows a project image as ![image](hammer://image/<id>), or with the destination in angle brackets, <hammer://image/<id>>. The alt text means nothing: Hammer shows the image’s own name.

Constants§

PREFIX
What every image reference starts with.

Functions§

find_ids
Every image id markdown refers to, each once, in the order they first appear: in images, angle-bracket destinations, reference definitions ([map]: hammer://image/3), and code alike, as Hammer counts them. A reference is hammer://image/ and its digits where no letter, digit, _, +, ., or - comes just before it and no letter, digit, or _ just after, so hammer://image/12x names none. An id too large for an i32 names none either.
get
The image a reference names, as parse_reference reads it, with its bytes: image.get, which the manifest must ask for. An InvalidInput error for a reference that names no image, and image.get’s for one not in project.
parse_reference
The image id a reference names: hammer://image/3, or <hammer://image/3>, is 3. None for anything else, such as another scheme, an id that is empty, not all ASCII digits, or too large for an i32.
reference
The reference to the image image_id, hammer://image/<id>, for Markdown such as ![image](…).