Creating a Page using a plugin

Hey there,

I’m trying to learn how to build plugins and I wanted to see how I can get a command that creates a new file. I know how to make a command that creates a new tab/leaf but not a file.

If I could also specify in the command the title and maybe some content that would be awesome. Here is my code:

async onload() {
			id: 'add-pane',
			name:  'Add a pane',
			checkCallback: (checking: boolean) => {
				const leaf =;
				if (leaf) {
					if (!checking){
						const new_leaf =;
					return true;
				return false;


If anyone has an idea, that would be great. I heard there is the Templater plugin that allows you to create files but if there is a way to do it “natively” that would be better.

Many thanks!