Wiki-Link Support — 2026-04-02
Goal
Make Obsidian-style wiki-links work in SlopDrop's markdown renderer. Documents using filename links should resolve to the correct SlopDrop URL.
Approach
The markdown renderer is a custom regex-based pipeline (no external library). Added a new regex step after standard text link processing:
.replace(/\[\[([^\]|]+?)(?:\|([^\]]+?))?\]\]/g, (_, target, display) => {
const linkText = display || target;
const currentDir = path.substring(0, path.lastIndexOf('/'));
const ext = target.includes('.') ? '' : '.md';
const href = currentDir
? `/${project}/${currentDir}/${target}${ext}`
: `/${project}/${target}${ext}`;
return `<a href="${href}" class="wiki-link">${linkText}</a>`;
})
Design Decisions
Relative resolution only — Links resolve relative to the current document's directory. No project-wide file search. This covers the common case (co-located files) without requiring a database lookup during render.
Auto-append .md — filename becomes a link to filename.md. If the target already has an extension, it's used as-is.
Styled differently — Wiki-links get a dashed underline via .wiki-link CSS class to distinguish them from regular links.
What's Not Supported (Yet)
- Project-wide resolution (searching all paths for a matching filename)
- Heading anchors (
file#heading) - Embed syntax (
!file)