DualLink is an efficient Obsidian plugin for linking, managing, and live previewing local and external physical files.
Due to Obsidian's vault mechanism limitations, handling large resource files (such as videos of tens of GB, lossless audio collections, or engineering source files) or system-level network drive mappings often requires keeping them outside the .obsidian vault. This plugin perfectly solves the pain point of "needing external path large file associations while also requiring smooth built-in preview", helping you seamlessly integrate external absolute path files and internal vault files within the same panel.
local-file:// association links, eliminating tedious manual path typing..mp4, .webm, .mp3, etc., supports inline rendering or native application activation, without consuming any vault storage space.custom-protocol:// (Recommended: safe sandbox isolation)file:/// (Standard cross-tool compatible protocol)Absolute Path (Raw direct address)![](); for "Internal Vault Mode", automatically derives standard internal link format [[ ]] and media resources auto-add prefix ![[ ]].DualLink is now available on the official Obsidian Community Plugin Marketplace!
main.js, styles.css, and manifest.json into your vault's .obsidian/plugins/dual-link/ directoryAfter enabling the plugin, you'll find a new icon in the left ribbon. Click to expand the interactive panel:
Open any system file manager, select files, drag directly to Markdown text position to generate links or image tags.
Open plugin settings to change "Default Link Format":
custom-protocol:// (Recommended)
Uses Obsidian's exposed safe protocol routing (starting with local-file://). Benefits: ignores cross-origin and strict security policy restrictions, can load external disk content without errors.file:/// Standard Protocol
Generated format starts with traditional browser file:// protocol. Better compatibility when using other third-party Markdown editors. May be blocked in strict security configurations.Absolute Path
No protocol tags, raw C:\Users\... format. Recommended for physical archive management directory registration.Ctrl or Cmd and click multiple files, "Insert N images (N columns)" button appears (auto-calculates ideal layout, supports up to 5 columns). Click to generate elegant duallink-gallery code block.DualLink exposes a public API for other plugins to programmatically generate links, pack files, and search external directories.
const dualLinkPlugin = this.app.plugins.getPlugin('dual-link');
if (dualLinkPlugin) {
const api = dualLinkPlugin.api;
// use api methods...
}
api.generateMarkdownLink(fileName: string, filePath: string): stringGenerates a formatted Markdown link based on the plugin's current settings (link style, file type detection, etc.).
const link = api.generateMarkdownLink('photo.jpg', 'D:/Photos/photo.jpg');
// Returns something like: ""
api.packToVault(): Promise<void>Opens the "Pack to Vault" modal, allowing users to copy or move external files into the Obsidian vault.
await api.packToVault();
api.packOut(): Promise<void>Opens the "Pack Out" modal, allowing users to export vault files to an external directory.
await api.packOut();
api.findExternalFileRec(fileName: string, dir: string, maxDepth?: number, currentDepth?: number): Promise<string | null>Recursively searches for a file by name within an external directory. Returns the full path if found, or null if not found.
const found = await api.findExternalFileRec('project-final.mp4', 'D:/Projects');
if (found) {
// found = "D:/Projects/2025/exports/project-final.mp4"
}
| Parameter | Type | Default | Description |
|---|---|---|---|
fileName |
string |
(required) | The file name to search for |
dir |
string |
(required) | Starting directory for recursive search |
maxDepth |
number |
4 |
Maximum directory depth to traverse |
currentDepth |
number |
0 |
Internal recursion tracker (usually omitted) |
# Install dependencies
npm install
# Frontend watch mode for instant debugging
npm run dev
# Build production targets
npm run build
DualLink 是一款专为 Obsidian 打造的高效本地及外部物理文件关联、管理与实时预览插件。
已上架 Obsidian 社区插件市场,可直接在 设置 → 第三方插件 → 浏览 中搜索 "DualLink" 安装。
local-file:// 关联.mp4 / .webm / .mp3 等格式内联渲染其他插件可通过 this.app.plugins.getPlugin('dual-link') 获取 DualLink 实例,调用 .api 上的方法:
| 方法 | 说明 |
|---|---|
generateMarkdownLink(name, path) |
根据当前设置生成格式化链接 |
packToVault() |
打开"导入到保险库"对话框 |
packOut() |
打开"导出到外部"对话框 |
findExternalFileRec(name, dir, depth?) |
递归查找外部文件并返回完整路径 |
MIT License