stevencohn / OneMore

A OneNote add-in with simple, yet powerful and useful features
Mozilla Public License 2.0
2.54k stars 213 forks source link

Hashtag tab completion, render hashtags as links which open search box #1514

Open cspotcode opened 1 month ago

cspotcode commented 1 month ago

I put two features into this issue, because implementing one makes it easier to implement the other. But I would be happy to split them into 2 issues if you prefer

Problem to Solve

Save typing, avoid typos, avoid the need to memorize hashtags.

Smooth navigation between all pages linked by a hashtag: click the tag in one place, it pops up the search box linking to all other occurrences of that hashtag.

New Feature/Solution

Type #, optionally some characters to narrow the search, then press Ctrl+Space. A dropdown appears which uses fuzzy search to narrow down a list of all known hashtags. Selecting a hashtag from the list with Arrow keys and Enter will insert it into the document.

For example, supposing I have hashtags for learning a new language: #japanese, #japanese-conjugation, #japanese-phrases, etc. Typing #jc, ctrl-space, and the fuzzy matcher shows me a dropdown of all hashtags which contain the characters jc in that order. It suggests #japanese-conjugation, which I can choose with arrows and Enter.


Because the user interacts with the dropdown, and it's modifying the document, it can also render the hashtag as a clickable link which shows the hashtag search dialog.

Alternative Solutions

I tried to find other tab-completion solutions I could use to achieve this. But I couldn't find anything in OneNote vanilla nor OneMore that offer a selectable list of options. Snippets, as far as I can tell, require you to type the name correctly from memory.

Rendering hashtags as clickable links could also be implemented as a post-process plugin script. Is there a URI that triggers the hashtag search box?

I also tested placing the caret inside a hashtag, then pressing Alt-F9 hotkey to open the hashtag search. But it doesn't prepopulate the search box with the hashtag. That could be another option.

Additional Context

cspotcode commented 1 month ago

I can't remember if I was aware of the Alt+T hashtag picker when I filed this issue. It seems really close to offering hashtag completions, if it somehow supported keyboard-only input. Say, if it auto-focused the input box, and let me type a few characters and press enter to choose the matced hashtag.

stevencohn commented 1 month ago

It's in the plans, but this was an initial release with. I prefer incremental implementation for people to respond an influence the direction, rather than investing too much time in things people don't actually use or enjoy (hence replacing page tags with hashtags! 😄 )