Skip to content

Instantly share code, notes, and snippets.

@kdmsnr
Last active May 29, 2024 23:30
Show Gist options
  • Save kdmsnr/532d482a56bdaffdf659b4bddb2b6153 to your computer and use it in GitHub Desktop.
Save kdmsnr/532d482a56bdaffdf659b4bddb2b6153 to your computer and use it in GitHub Desktop.
obsidianでTODO.mdを左のアイコンから開きたい
import { App, Plugin, Notice } from 'obsidian';
export default class MySidebarPlugin extends Plugin {
async onload() {
this.addRibbonIcon('checkmark', 'Open TODO Page', async () => {
const file = this.app.vault.getAbstractFileByPath('TODO.md');
if (file) {
this.app.workspace.getLeaf().openFile(file);
} else {
new Notice('File not found');
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment