pbek / QOwnNotes

QOwnNotes is a plain-text file notepad and todo-list manager with Markdown support and Nextcloud / ownCloud integration.
https://www.qownnotes.org/
GNU General Public License v2.0
4.67k stars 413 forks source link

Allow applying Markdown related commands to multiple lines (e.g. creating list items) #694

Open florianklumb opened 7 years ago

florianklumb commented 7 years ago

Expected behaviour

Please consider supporting this use case.

The same for numbered lists, links, headlines, markup such as bold.

bepolymathe commented 7 years ago

Hi,

Ctl-B insert **** for bold for multiple lines too... Ctl-L insert URL and link to another note

For "list" it's a good suggestion, and maybe just have to click enter to add a second bullet point when you had insert one before like : - Point one [enter created point two like "- "]

pbek commented 7 years ago

@yodayeti, thank you for your suggestion, you can easily do that with the script-engine, just visit http://docs.qownnotes.org. Maybe @Maboroshy wants to help too. ;)

pbek commented 7 years ago

look at http://docs.qownnotes.org/en/develop/scripting/README.html#read-the-selected-text-in-the-note-text-edit and http://docs.qownnotes.org/en/develop/scripting/README.html#write-text-to-the-note-text-edit

Maboroshy commented 7 years ago

I'd use script.noteTextEditSelectedText() to get selected text, alter it in the script, and then write by script.noteTextEditWrite(). Altering would be something like adding - or number at the start of any line that doesn't begin with \n.

As far as I understand, new text should replace the selected one, like when typing with selected text. I haven't checked it though.

...links, headlines, markup such as bold

That part needs some clarification.

Maboroshy commented 7 years ago

Since nobody took this, I've started writing the script. I now have basic implementation of ordered and unordered lists working. Changing headline depth for #672 will also be in the script. I want to add some advanced features, like mixed formatting unification and ordered list continuation, and then make release.

Maboroshy commented 7 years ago

Please, check the new "List maker" script.

bepolymathe commented 7 years ago

It works ! That's great ! Thank you. ;»)

Maboroshy commented 7 years ago

I've implemented sub-lists for numbered lists in the new version. Only one level of nesting is supported.

A
 x
 z
B

will become

1. A
 1.1. x
 1.2. z
2. B

Making all transitions and continuations support this was quite an exercise. The code is too "magic" now. Maybe I'll have some insights on refactoring it next time.

somple commented 6 years ago

@Maboroshy

Hi, I am totally new with QOwnNotes

Where do I find the 'List Maker' script?

pbek commented 6 years ago

Scripting menu, Script repository, then search for the script name