Asset Bundling & Resolution
@sullux/markdown-slides automatically bundles local media, out-of-tree assets, and remote web images into a single self-contained, offline-ready presentation folder.
Offline Presentations
When you embed images in your slides—whether local files, parent directory references, or remote URLs—the compiler resolves them during build time:
# Local image in deck folder

# Out-of-tree image in parent directory

# Remote image from web URL

During build:
- Local images inside your deck directory are copied to
dist/images/. - Out-of-tree local images (e.g.
../../docs/logo.svg) are located, copied, and bundled intodist/images/. - Remote web images (
https://...) are fetched via Node's nativefetch()and saved locally todist/images/. - All Markdown image links in the AST are rewritten to reference the local relative path (e.g.
images/logo.svg).
The resulting presentation folder can be opened on an airplane, in an air-gapped environment, or transferred to another computer without broken image links.
The Minimum Viable Suffix Algorithm
To avoid ugly opaque hashes (e.g. a4f89b1c.svg) while preventing name collisions between images from different folders, @sullux/markdown-slides uses a Minimum Viable Suffix algorithm:
1. Root Canonicalization & Anonymization
All paths are converted to canonical roots:
- Remote URLs map to
/remote/<hostname>/<path>(e.g./remote/sullux.com/images/logo.svg). - Local paths re-root the user's home directory to
/user/...(e.g./user/sullux/docs/logo.svg) to ensure reproducible, anonymized builds across different developers and CI machines. - Windows drive letters are normalized (
c:/$\rightarrow$/,d:/$\rightarrow$/d/).
2. Deduplication
If multiple slides reference the exact same asset URL or local path, the asset is downloaded or copied only once and shared across all slides.
3. Disambiguation by Parent Peeling
Uniqueness is evaluated case-insensitively. If multiple assets share the same filename:
- If unique, the original filename is preserved with zero noise:
logo.svg. - If a collision occurs (e.g.
docs/logo.svgvsimages/logo.svg), the algorithm peels parent directory segments until names are distinct:docs-logo.svgandimages-logo.svg. - In the rare event of identical paths differing only by case, a terminal numeric suffix is appended:
foo.svgandFoo-2.svg.