Import Attachments+

by alberti42
5
4
3
2
1
Score: 45/100

Description

Import attachments by moving them into the vault.

Reviews

No reviews yet.

Stats

22
stars
4,776
downloads
2
forks
158
days
55
days
55
days
2
total PRs
0
open PRs
0
closed PRs
2
merged PRs
25
total issues
11
open issues
14
closed issues
154
commits

Latest Version

2 months ago

Changelog

A maintenance release: no new features, and nothing that changes how the plugin behaves in normal use. It clears almost all of the remaining warnings from Obsidian's community-plugin review and tightens how Node APIs are reached.

Clearer errors instead of confusing ones

The desktop-only helpers — file copying and moving, MD5 hashing for ${md5}, path conversion — reach for Node APIs only inside the functions that use them, and now say so plainly if they are ever reached where those APIs do not exist. Previously that produced an unhelpful TypeError: Cannot read properties of undefined.

If you use Obsidian's mobile emulation developer command, note that the plugin now treats that as mobile: the desktop-only helpers refuse rather than working through Electron behind the emulation. Ordinary desktop and mobile use is unaffected.

Internal

  • Node's fs, path and crypto are reached through guarded accessors, so nothing Node-related is touched merely to load the plugin.
  • The import dialog's file picker and a few modal elements are built with Obsidian's own DOM helpers.
  • Development tracing moved to console.debug, the level Obsidian's guidelines allow for it.
  • The reviewer's own lint rules can now be run from the repository (npm run lint:obsidian), which is how the remaining findings were checked rather than guessed at.

No settings migration, and minAppVersion is unchanged at 1.13.0.

README file from

Github

Import Attachments+ for Obsidian

Overview

Import Attachments+ is a plugin designed to enhance the attachment management experience in Obsidian. It allows you to import, organize, and handle attachments (like images, documents, and other files) seamlessly within your vault.

Features include:

  • Moving or copying files into the vault upon import.
  • Embedding or linking attachments.
  • Configurable folder structures for attachments.
  • Customizable naming conventions for imported files.
  • Management tools for attachment folders.
  • Keeping attachments with the notes that use them when text is moved between notes.

Usage

Once enabled, the plugin will work automatically based on your configured preferences. You can adjust these settings through the plugin's settings tab under Settings > Import Attachments+.

Keeping attachments with their notes

When you split a note — by extracting a selection, merging notes, or simply cutting and pasting text — the attachments referenced by that text stay behind in the original note's attachment folder. The plugin moves them into the attachment folder of the note that now uses them, updating all links.

An attachment is only moved when the note it is currently filed under no longer references it; one that is still in use stays where it is, as does anything outside the attachment folders this plugin manages. This is controlled by the setting "Let attachments follow the text that uses them", which is enabled by default.

To tidy up a vault after the fact, or with that setting disabled, run the command Move stray attachments to their note's folder. It lists every attachment that is filed under one note but used by another, with a preview and a per-file confirmation, before moving anything.

Commands

Command Description
Move file to vault as linked attachment Pick a file and move it into the vault, inserting a link.
Move file to vault as embedded attachment As above, inserting an embed.
Copy file to vault as linked attachment Pick a file and copy it into the vault, inserting a link.
Copy file to vault as embedded attachment As above, inserting an embed.
Open attachments folder Open the current note's attachment folder in the system file manager.
Move stray attachments to their note's folder Review and relocate attachments that are filed under a note which no longer uses them.

Settings

The plugin offers a comprehensive set of options for managing attachments.

Key settings
  1. Import Options:

    • Move or copy files on drag-and-drop or copy-and-paste.
    • Embed or link imported attachments.
    • Import multiple files as a list or inline.
  2. Attachment Folder Configuration:

    • Set the default location for new attachments.
    • Define folder paths relative to the note's location.
    • Customize attachment file names and date formats.
  3. Attachment Opening:

    • Open attachments with the default external application or reveal them in the system's file manager.
  4. Attachment Management:

    • Rename and delete attachment folders automatically.
    • Remove attachment folders once they are left empty.
    • Confirm before deleting an attachment folder that still contains files.
    • Let attachments follow the text that uses them when it is moved to another note.
  5. Display of Attachment Folders:

    • Toggle the visibility of attachment folders in the file explorer.

Search for "Import Attachments+" in the Community plugins pane in Obsidian and click on the Install button.

Manual Installation

Option 1: Download Pre-Built Files
  1. Download the latest release from the GitHub releases page.
  2. In the release, you'll find the main.js, manifest.json and styles.css files.
  3. Copy these three files to a new folder in your vault's .obsidian/plugins/ directory (e.g., .obsidian/plugins/import-attachments-plus).
  4. Enable the plugin Import Attachments+ in Obsidian via Settings > Community Plugins.
Option 2: Build from Source
  1. Clone this repository or download the source code from the GitHub repository.

  2. Run the following commands to install the necessary dependencies and build the plugin. The build process will generate the main.js and manifest.json files inside the /dist subfolder within the repository directory:

    npm install
    npm run build
    

Donations

I would be grateful for any donation to support the development of this plugin.

Author

  • Author: Andrea Alberti
  • GitHub Profile: alberti42
  • Donations: Buy Me a Coffee

Feel free to contribute to the development of this plugin or report any issues in the GitHub repository.