Hello everyone!
I’m excited to share External File Embed and Link, a plugin I created that allows you to embed and link local files outside your Obsidian vault with relative paths. This helps ensure cross-device and multi-platform compatibility, perfect for those of us who sync or move our vaults across different systems.
Why Use This Plugin?
- Embed external files (Markdown, PDF, images, audio, video) directly into Obsidian’s reading and live preview modes.
- Link to external files that can open with the default system application.
- Use relative paths (relative to your Home directory or Vault directory) so your notes remain consistent on different devices and operating systems.
- Simple commands for embedding/linking via a file picker, plus drag & drop support.
Core Features
-
Embed External Files
- Supports Markdown files, PDFs, images, audio, and video.
- Accepts parameters for page numbers, size, etc.
- Helpful if you want to keep large files outside your vault but still view them in Obsidian.
-
Link External Files
- Inserts a clickable link that opens the file in its default system application.
- Useful for files you don’t need to preview directly in Obsidian.
-
Relative Paths
- Reference files using paths relative to your Home directory or your Vault directory.
- Ensures portability across multiple devices/platforms (especially if you use services like SynologyDrive).
-
Easy Embedding/Linking
- Commands in the command palette to quickly add embeds/links.
- Drag & drop files while holding modifier keys to automatically generate embed or link syntax.
Usage Examples
1. Embedding a File (Relative to Home)
```EmbedRelativeToHome
SynologyDrive/work/Document.pdf
```
This will display the PDF file in Reading Mode or Live Preview. If your Home directory is C:\Users\username
, the plugin will locate the file at C:\Users\username\SynologyDrive\work\Document.pdf
.
2. Embedding a File (Relative to Vault)
```EmbedRelativeToVault
../work/Document.pdf
```
If your vault is at C:\Users\username\SynologyDrive\obsidian
, the file above will be found one level up in the work
folder.
3. Linking an External File
```LinkRelativeToHome
Downloads/sample.pdf
```
This generates a clickable link that opens sample.pdf
using your default PDF application.
4. Inline Link Example
This is a <a class=LinkRelativeToHome>Downloads/sample.pdf</a> outside of the vault.
This inserts an inline link within a paragraph.
Embedding Options & Parameters
- Markdown: You can embed specific headers by adding
#header
after the file name. - PDF: Use
#page=3&width=100%&height=80vh
to control page number, width, and height. - Images & Video: Append
|400
or|800x600
to specify width or width/height.
Example for PDFs:
```EmbedRelativeToHome
SynologyDrive/work/Document.pdf#page=3&width=100%&height=80vh
```
Commands & Drag/Drop
Type “external” in the Obsidian command palette to see all commands for adding embeds or links.
You can also drag & drop files from outside your vault; just hold the configured modifier keys (e.g., Ctrl
, Shift
, Ctrl+Shift
) to automatically create an embed or link. The modifier keys are customizable in the plugin’s settings.
Installation
- Go to Settings > Community Plugins in Obsidian.
- Enable Community Plugins.
- Search for “External File Embed and Link”.
- Install and enable it.
- Adjust settings if needed (modifier keys, default relative path, etc.).
Try it out and let me know what you think!
Feel free to ask questions or share feedback here. I hope it makes managing external files in Obsidian more convenient and flexible for everyone!