Skip to content

Resources and security

Resolve relative references against the location of the document. For example, ./images/flow.png next to notes/plan.md refers to notes/images/flow.png. Use an application-controlled document record to decide which account, repository, or attachment store the reference belongs to.

notes/
├── plan.md
└── images/
└── flow.png
![Release flow](./images/flow.png)

Choose a policy before passing a resolver to the reader. Check the fully resolved origin and normalized path, and apply the same authorization your app uses when serving the attachment itself.

Resource What the host returns
Image An authorized image Blob, or null.
Audio or video An authorized Blob, { url: string } with an approved absolute HTTP(S) URL, or null.
Relative link An absolute HTTP(S) or mailto URL, or null to show the label as text.

Image and media requests receive an AbortSignal. Pass the signal to your fetch or storage client so updates or teardown can cancel work. A direct media URL is fetched by the browser’s player. Check authorization, server format support, and range requests where seeking matters. See resolver signatures.

An image resolver can pass the original reference to the application’s attachment service. In this example, authorizedImageURL is a host function that checks the document and its permissions before returning a URL.

const resolveImage = async (reference, signal) => {
const url = await authorizedImageURL(documentId, reference, signal);
if (!url) return null;
const response = await fetch(url, { signal, redirect: "error" });
return response.ok ? response.blob() : null;
};
const reader = render(container, source, options, resolveImage);

Treat Markdown and its resource references as user input. The host resolves permission to read each resource; syntax recognition grants no access. Avoid passing file paths, arbitrary remote URLs, or active content directly through a resolver. The browser reader validates supported image data and isolates diagrams as images. Unsupported or rejected material stays as a source block or a readable placeholder.

SFM accepts related Markdown structures in Space and on the web. The web reader applies its own restrictions on HTML, diagram directives, and networked resources. Use the compatibility guide when a document renders differently from Space.