🐴 Replace function that you can use across all notes?

Hi Takuya,

I’d very much like a replace function that you can use across all notes.

The new search bar does a great job off finding all instances of a unique string I have in my notes, I’d like to have it auto changed across hundreds of my notes. I’d love to be able to replace the found unique string with something else for all finds.

Kind regards,

Sceptic

1 Like

Hi Sceptic,

Thanks for the suggestion.
It seems to be something like a kind of batch processing feature.
I haven’t ever thought I need it because it’s for taking notes, not designed for writing documentation. So, you shouldn’t need to strictly organize content such as tokens, IDs, or something like that. What’s the unique string you want to replace in your case?

If you still want it, you can create a custom command with init.js that replaces keywords across notes using the database APIs. Just like you write a shell script to accomplish that in filesystem.

The string is part of the template I use for all my notes. In this case the date section.

Ooh that is another feature I would love. To be able to create different templates. I have different templates for different type of notes and a default one. I would love to be able to set this in the settings instead of copy/pasting them. Especially on mobile this would save me a lot of time.

Back to the replace, I’m trying to do this from the dev console. Is there a way I can just get an array of all notes and replace the string and force a sync after the change?

I was also thinking just doing this using the export and restore function, and just use Visual Code to replace the string in all the JSON files before restoring them. This way I also have backup in case anything goes wrong. :slight_smile:

But still, I think this could be a nice official feature added to the Inkdrop search box. My use case would be rare but there are other things this would be useful for. Like replacing a word or name you’ve always spelled incorrectly etc.

As to templates, I think you want to check out a community plugin for that: https://my.inkdrop.app/plugins/inkdrop-note-templates
I agree that it’d be nice to support on mobile as well.

You can check out DBNote API which provides a way to get & update notes:

const db = inkdrop.main.dataStore.getLocalDB()
const notes = await db.notes.all({ limit: 100 })

If you’d like to access notes with your favorite language, you can use the local HTTP server API instead:

The backup feature doesn’t work in this case. It checks notes’ revisions to determine if it should import them or not.

It’d be one of the nice-to-have features, but I’d like to focus on the core features. I’m currently working on building a native Markdown editor for mobile.

Aah yes it sadly would have to be for mobile, I seldom make new notes on a desktop. That plugin looks nice albeit maybe a bit over engineered? Only missing feature would be a default template for new notes. Saving you time there.

Thanks I’ll have a go at it sometime with the console again. *After I do a backup first. :grin:

1 Like

FYI, I’ve also written a tutorial to make a template for a notebook on the documentation:

I agree that a template for each notebook would be nice to have. Let’s discuss it when finished the current roadmap.

Yeah, please be careful to update the notes via API!

your information is very interesting and good question but i am not idea

I’d still love a replace all feature. :eyes:

That’d be nice to be a plugin.

The Inkdrop Unicorn :unicorn: :

“Even nicer, [whinnies], as a full fledged original feature! :hear_no_evil: :stuck_out_tongue_winking_eye:

FIY, it got the local HTTP server API now:

So, you can read & update not only note bodies but also metadata in your favorite language via HTTP.

Hmm, nice new feature! The API seems clear enough. But I kinda know I probably won’t take the time for creating it myself. Its a nice to have, not a must have luckily. :sweat_smile: