Skip to content

Commit 4bc286d

Browse files
authored
5.0.0 (#21)
- Renamed plugin from "Paste to Current Indentation" to "Paste Mode," reflecting that the scope of the plugin has increased over the past several releases. - Added the ability for remote images referenced in pasted HTML to be locally downloaded when pasting.
1 parent 5e65ab1 commit 4bc286d

10 files changed

+260
-64
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ main.js
1212

1313
# obsidian
1414
data.json
15+
16+
# For the Obsidian hotreload plugin:
17+
.hotreload

README.md

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
## Obsidian Paste to Current Indentation Plugin
1+
## Obsidian Paste Mode
22

33
An [Obsidian](https://obsidian.md/) plugin to paste and manage text, including block quotes, that are indented. This plugin helps especially with embedding code, quotes, and other content within lists.
44

5+
_(This plugin was formerly titled "Paste to Current Indentation".)
6+
57
### "Paste modes"
68

7-
Paste to Current Indentation takes over the paste functionality within Obsidian. It has eight "paste modes," which determine what happens when one pastes text within a file in Obsidian. **All of the below will honor the cursor's current indentation when pasting, except for "Passthrough" mode, which uses Obsidian's default paste functionality.**
9+
Paste Mode takes over the paste functionality within Obsidian. It has eight "paste modes," which determine what happens when one pastes text within a file in Obsidian. **All of the below will honor the cursor's current indentation when pasting, except for "Passthrough" mode, which uses Obsidian's default paste functionality.**
810

911
![Demonstration of paste modes](img/all-paste-modes.gif)
1012

@@ -20,44 +22,60 @@ The current paste mode is displayed in Obsidian's Status Bar:
2022

2123
![Status bar showing current paste mode](img/status-bar.png)
2224

23-
### Switching paste mode
25+
#### Switching paste mode
2426

2527
There are multiple ways to switch paste modes:
2628

2729
1. Clicking the status bar paste mode display will bring up a searchable menu with which you can select a new mode.
28-
1. Open the Command Palette and search for `Paste to Current Indentation: Cycle Paste Mode`. This command is equivalent to clicking the satus bar.
29-
1. Open the Command Palette and search for `Paste to Current Indentation: Set Paste Mode`. One command per paste mode is provided.
30+
1. Open the Command Palette and search for `Paste Mode: Cycle Paste Mode`. This command is equivalent to clicking the satus bar.
31+
1. Open the Command Palette and search for `Paste Mode: Set Paste Mode`. One command per paste mode is provided.
3032
- These commands could be used, e.g., with the Obsidian [Quick Add plugin](https://github.com/chhoumann/quickadd/blob/master/docs/Choices/MacroChoice.md) to assign a keyboard command for switching to a given mode and then pasting.
31-
1. Open the Command Palette and search for `Paste to Current Indentation: Cycle Paste Mode`. This command will cycle through the different paste modes (i.e., from Text mode to Text Blockquote mode, to Markdown mode, to Markdown Blockquote mode, to Passthrough mode, back to Text mode, etc.)
33+
1. Open the Command Palette and search for `Paste Mode: Cycle Paste Mode`. This command will cycle through the different paste modes (i.e., from Text mode to Text Blockquote mode, to Markdown mode, to Markdown Blockquote mode, to Passthrough mode, back to Text mode, etc.)
3234
1. Within the plugin's Settings page.
3335

34-
### Limitations of Paste Modes
36+
#### Limitations of Paste Modes
3537

3638
- The "Markdown" and "Markdown (Blockquote)" modes are automatically disabled **for one-time commands** (i.e., for the "Paste in Markdown Mode," "Paste in Markdown (Blockquote) Mode", and "Paste in Mode (Interactive)" commands) in Obsidian Mobile. This is due to how Obsidian Mobile is allowed to interact with the clipboard.
3739
If these commands are disabled, a note stating such will appear in the Settings tab for the plugin.
3840
- Similarly, in Obsidian Mobile, images such as screenshots, and similar files, cannot be pasted from the clipboard, due to how Obsidian Mobile is allowed to interact with the clipboard.
3941

4042
### Additional commands
4143

42-
- Within the Command Palette, the `Paste to Current Indentation: Toggle blockquote at current indentation` command will toggle blockquote markers at the highlighted text's current level of indentation.
44+
- Within the Command Palette, the `Paste Mode: Toggle blockquote at current indentation` command will toggle blockquote markers at the highlighted text's current level of indentation.
4345

4446
![Toggle blockquote command](img/toggle-blockquote.gif)
4547

4648
Block quote markers are customizable via the plugin's Settings page (e.g., if you prefer to use spaces instead of `> `).
4749

48-
# Roadmap
50+
### Additional features
51+
52+
#### Dynamic attachment saving
53+
54+
- Attachments can be automatically saved to different locations based on the directory of the file being pasted into.
55+
56+
![](img/attachment_location_overrides.png)
57+
58+
#### Downloading local copies of linked attachments
59+
60+
- When pasting in "Markdown" or "Markdown (Blockquote)" modes, files that are linked in the text (`http://example.com/path/to/file.png`, `file://path/to/file.png`, etc.) can be automatically downloaded locally, based on their source location.
61+
62+
#### Automatic character escaping in Markdown
63+
64+
Characters that might cause display issues in Markdown (such as `==`, `<`, etc.) can be automatically [escaped](https://www.markdownguide.org/basic-syntax/#characters-you-can-escape) when pasting.
65+
66+
### Roadmap
4967

5068
I consider this plugin feature-complete for now.
5169

5270
Todo:
5371

5472
- Add tests
5573

56-
# Developing for this plugin
74+
### Developing for this plugin
5775

5876
The documentation below is retained from the [Obsidian Sample Plugin](https://github.com/obsidianmd/obsidian-sample-plugin).
5977

60-
## Quickstart guide for development
78+
#### Quickstart guide for development
6179

6280
- Clone this repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder.
6381
- Install NodeJS, then run `yarn` in the command line under your repo folder.
@@ -67,7 +85,7 @@ The documentation below is retained from the [Obsidian Sample Plugin](https://gi
6785
- Reload Obsidian to load the new version of the plugin.
6886
- For updates to the Obsidian API run `yarn` in the command line under this repo's folder.
6987

70-
## Developing for mobile
88+
#### Developing for mobile
7189

7290
Mobile development can be facilitated using the following workflow:
7391

@@ -76,18 +94,18 @@ Mobile development can be facilitated using the following workflow:
7694
1. Follow [the advice in this post](https://forum.obsidian.md/t/debugging-obsidian-mobile-plugins/20913):
7795
> How to test plugins on Android I think you need to have ADB on your computer installed (I always had that installed; if the following directions don’t work without it, install it); on your android phone you have to enable ADB (it’s under developer settings [tap the build number three times to get these settings]); then connect the phone to your computer over USB; open chrome (or chromium based browser should also work) and type chrome://inspect in the browser. Open obsidian on your phone, then it should appear in the browser. You will have the console and the inspector like you have for desktop Obsidian
7896
79-
## Releasing new releases
97+
#### Releasing new releases
8098

8199
- Update `manifest.json` with the new version number, such as `1.0.1`, and the minimum Obsidian version required for the latest release.
82100
- Update the `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of the plugin that's compatible.
83101
- Create new GitHub release using the new version number as the "Tag version". Use the exact version number (i.e., do not include a prefix `v`). See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases
84102
- Upload the files `manifest.json`, `main.js`, and `styles.css` as binary attachments.
85103
- Publish the release.
86104

87-
## Manually installing the plugin
105+
### Manually installing the plugin
88106

89107
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/obsidian-paste-to-current-indentation/`.
90108

91-
## Obsidian API documentation
109+
### Obsidian API documentation
92110

93111
See https://github.com/obsidianmd/obsidian-api

createIconsDict.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ for (const f of iconFiles) {
1818
}
1919

2020
fs.writeFile('icons.json', JSON.stringify(iconsDict), (err) => {
21-
// throws an error, you could also catch it here
2221
if (err) throw err;
2322

24-
// success case, the file was saved
25-
console.log('Icons file updated.');
23+
// console.log('Icons file updated.');
2624
});

img/attachment_location_overrides.png

40.6 KB
Loading

0 commit comments

Comments
 (0)