Your use of Obsidian can often be improved with a little bit of scripting. However you script Obsidian, if you want to make Obsidian do something you will likely find yourself interacting with the App object .
One way to do this is through reading the documentation, or looking at the source code that plugins use to bind to Obsidian. You could also browse the forum, which contains various snippets or ask questions there.
However, one problem is that many of the methods available on the app
object are not documented, yet are necessarily to do what you want to do, and are in fact at times used by plugins in practice to get their job done. Examples are interacting with commands and plugins. Also it can be good to “experiment at bit” while coding by interacting with these the app Object directly.
Using the Developer console
You can get at a developer console (like a browser uses) by pressing Ctrl+Shift+I. This has a “Console” tab which you can use to execute JavaScript - and has access to an app object. The shell is quite slick - since lots of people use JavaScript. It has completion with fuzzy search and previews values. When you have an object it displays it in a way that lets you collapse and expand different variables
Using Plugin REPL (of which I am the author)
You can also install Plugin REPL a tool for in-editor scripting that follows some of the norms of the venerable Emacs editor, to execute JavaScript expressions from within an Obsidian note. This has a couple of benefits - it permanently keeps your history, and allows you to copy and paste results, and can be quite good for “building up expressions”, and generally one is a bit more “free” outside of a the single line of a prompt.
To list the properties on an object you can use dir(app)
or to get a fuzzy selector listing values you can use fuzzyDir(app).
You can also use this snippet to “complete” properties on app.
Here’s a demo:
I am readwithai. I make tools and write about things related to reading and productivity in Obsidian. If you liked this post you might be interested in my cookbook of things you can do in Obsidian and Plugin REPL. Or, if you are feeling in an “academic mood” perhaps you want to read my review of note taking in Obsidian.