Custom markdown view for files with certain properties

I’m working on a plugin that should open files with a certain parameter with a my custom view. How can I override default markdown view and open custom view in current active tab?

// inside your plugin onload

this.app.viewRegistry.unregisterExtensions(["md"]));
this.registerView("your_view_name", viewCreator);
this.registerExtensions(["md"], "your_view_name");
        

Thank you!

		this.app.viewRegistry.unregisterExtensions(["md"]);
		this.app.viewRegistry.unregisterView('markdown');
		
		this.registerView(
			MY_VIEW,
			(leaf) => {
				return new MyView(leaf)
			} 
		);
		
		this.registerExtensions(['md'], MY_VIEW)

This worked