jglev / obsidian-paste-mode

Obsidian Notes plugin for pasting text and blockquotes to the cursor's current level of indentation.
Other
48 stars 2 forks source link

[Feature Request] Paste to the first line in a list item #19

Closed user30535 closed 2 years ago

user30535 commented 2 years ago

Let's say I want to paste content to [paste here]:

- [paste here]

The result I got is

- Abc

Abc

Abc

But the expected result is

- Abc

  Abc

  Abc

It would be really nice if this is possible.

Thank you!

jglev commented 2 years ago

@user30535, thank you for writing!

I see what you mean. I've drafted support for this just now, and created a pre-release for it here. Are you familiar with manually installing plugin updates? If so, would you be willing to try these changes before I create a full release?

user30535 commented 2 years ago

@user30535, thank you for writing!

I see what you mean. I've drafted support for this just now, and created a pre-release for it here. Are you familiar with manually installing plugin updates? If so, would you be willing to try these changes before I create a full release?

Thank you so much! I just installed and tried and it works very well.

Now it works for bullets points, but cannot handle numbered lists. I personally don't use numbered lists that much, but some people may need it.

user30535 commented 2 years ago

oh and also maybe some people need support for checkbox lists.


- [ ] ABC

      ABC

      ABC
jglev commented 2 years ago

@user30535, thank you! I hadn't thought of those other cases, and I take your point. I've released 4.0.0-beta1 just now with some additional changes (the version number has risen to 4.0.0 because I've bundled another new, larger feature in with this change).

Because many/most Obsidian users won't be using monospaced fonts, I don't think that it will be feasible to align text exactly as in your checkbox example. But this change will handle any existing text (whether a bullet list, numbered list, checkbox, or anything else), and add up to 3 additional spaces to subsequent lines to indent them under the first line (such that it looks correct in Reading Mode).

Does that seem reasonable to you, too?

jglev commented 2 years ago

@user30535, I've released 4.0.0 just now with the changes above incorporated. I'm going to close this Issue for now, thinking it addressed -- but please feel free to write to let me know if any bugs or issues come up, and I can reopen it!

user30535 commented 1 year ago

Hi jglev, thanks a lot for the update. I'm trying the changes noted above, and I noticed one problem.

For ordered list items with indices larger than or equal to 10, we need 4 or more spaces of indentation for the following nested paragraphs. For example, I was trying to use the plugin to paste

paragraph 1

paragraph 2

after 10. to get

10. paragraph 1

    paragraph 2

There should be 4 spaces before paragraph 2, but currently the plugin only adds 3 spaces before paragraph 2.