Media and Images
How media links are resolved in serve and build modes.
Notepub rewrites image references from markdown and Obsidian embeds.
For template repositories and CI pipelines, Obsidian embed normalization is typically done in a pre-build script.
That script can also normalize hub wikilinks in frontmatter for stable client-side hub filtering.
Supported image syntaxes
- Markdown image:
 - Obsidian embed:
!\[\[image.png\]\] - Obsidian embed with alt-like label:
!\[\[image.png|Cover image\]\]
Serve mode behavior
- Relative media links are resolved to
/media/...unlesssite.media_base_urlis set. /media/*is guarded by indexed references by default.- Set
media.expose_all_under_prefix: trueto expose all media under prefix.
Build mode behavior
- Relative media links should resolve to an absolute asset base for static hosts.
- Set
site.media_base_urlto CDN/bucket base URL. - Without
site.media_base_url, static output may contain/media/*URLs that do not work on pure static hosts.
Security and path handling
- External URLs (
http,https,data, protocol-relative) are not rewritten. - Unsafe traversal keys are rejected.
- Media paths are escaped before URL output.