Skip to content

Demo vault

Every screenshot and code block on this page comes from the bundled demo vault.

Download the English demo vault

Annotation syntax ​

Every parameter lives in the image alt text, separated by |. Fields starting with ag: are parameters; the first field that does not start with ag: is the caption.

Syntax rules ​

markdown
![caption|ag:layout=float|ag:side=right|ag:width=38%](assets/photo/11-shore.jpg)
RuleExplanation
Separatorthe pipe |, nothing else
Prefixparameters must start with ag:, the key follows the colon
Assignmentuse =, not a colon
Caption positionthe first non-ag: field; it may sit anywhere but usually comes first
Unknown keyskept, never an error — reserved for future versions
Inside tablesthe pipe must be escaped as | or it splits the cell

The ten parameters ​

ParameterValuesEffectApplies to
ag:layoutauto gallery float centeroverride automatic layoutsingle image
ag:sideleft right centerpick a side; center does not floatsingle image
ag:width10%–100%fixed column percentage, 100% means full width, centredsingle image
ag:gap0–80 (px optional)gap between a floated image and the textfloated images only
ag:cropW:Hframe ratio, showing only part of the sourcesingle image, tables
ag:topx1:x2:y (each 0–100)horizontal span and vertical start of the crop framerequires ag:crop
ag:isolateflag / =falsetake this image out of the gallery and split the groups around itanywhere
ag:excludeflag / =falsehand the image back to Obsidian entirelyanywhere
ag:rows3,2hand-written row split: how many images each row holds from the group's first image; the rest is packedgalleries
ag:groupflag / positive integer / =falselock a row together; adjacent rows need different idsgalleries
The same set of parameters controls layout, width and float side

The same set of parameters controls layout, width and float side.

Parameter by parameter ​

ag:layout ​

Overrides the automatic decision. Four values:

  • auto — default, width routing decides.
  • gallery — treat as a gallery even when there is only one image.
  • float — float even when the width exceeds floatMax.
  • center — force a centred block, never float.

ag:side ​

Picks the horizontal position. left and right float; center equals ag:layout=center. A template's floatAlignment only decides which side is used when no side is given; an explicit side wins.

ag:width ​

A fixed column percentage, valid range 10%–100%. Once present the routing curve is skipped, but the float test still runs — above floatMax the image is centred anyway. So ag:width=95% produces a centred wide image, not a floated one.

ag:gap ​

Only affects the gap between a floated image and adjacent body text, in px, the px suffix optional. It has no effect on gallery cell spacing — that value lives in the settings.

ag:crop ​

A frame ratio such as 1:1, 16:9 or 24:17. It decides the shape of the frame, not its position; position comes from ag:top. The cropped ratio feeds width routing, so cropping changes how wide the image appears on the page.

ag:top ​

Three numbers in x1:x2:y, each 0–100:

FieldMeaning
x1left edge of the frame, as a percentage of the source width
x2right edge
ytop edge, as a percentage of the source height

Only one vertical number is needed because the height follows from the ag:crop ratio. Swapped edges are corrected, out-of-range values are clamped.

Without ag:crop, ag:top is dropped the next time parameters are rewritten — a frequent trap.

ag:isolate ​

A flag: ag:isolate or ag:isolate=true. The image leaves the current gallery and splits the groups before and after it, so those images no longer merge. The caption stays and the plugin still computes the width.

ag:exclude ​

Hands the image back to Obsidian completely: no width, no caption, no gallery. Use it when you want to control that image with your own HTML.

ag:rows ​

Written on the first image of the group, a comma-separated list of segment lengths such as 3,2. It describes the opening rows only: counts are consumed in order, the last one is truncated at the end of the group, and the remaining images are packed automatically — six pictures with 4,3,1 give "four, two", with 2,3 give "two, three, one (packed)". No picture is lost, and no gesture ever writes it. A named row skips the minimum row height and is not bound by the max-per-row ceiling.

ag:group ​

A flag or a positive integer. Consecutive images sharing an id lock into one row; adjacent rows must use different ids or they merge.

Deprecated keys ​

fit, focus and a bare top no longer do anything, but are preserved in the source. Use ag:crop and ag:top instead.

Where each parameter applies ​

ParameterGallerySingleListTableCallout
ag:layoutignoredyesnonono
ag:widthignoredyesyesnono
ag:sideignoredyesnonono
ag:gapignoredyesnonono
ag:cropyesyesyesyesno
ag:topyesyesyesyesno
ag:isolateyesyesyesnono
ag:excludeyesyesyesyesno
ag:rowsyes—nonono
ag:groupyes—nonono

Next ​