Get current file content in Obsidian

If you are creating a plugin for Obsidian, and you want to get the currently opened file/note and its content, use this code…

const noteFile =; // Currently Open Note
if(! return; // Nothing Open

// Read the currently open note file. We are reading it off the HDD - we are NOT accessing the editor to do this.
let text = await; 
Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

Leave a Reply

Your email address will not be published.