According to the docs
MarkdownPreviewView
class has constructor
constructor(containerEl: HTMLElement);
which is inherited from grandparent MarkdownRenderChild.(constructor)
However, calling
new MarkdownPreviewView(containerEl);
will fail in runtime.
The reason for the failure is that the typing doesn’t match the actual non-exported constructor, which based on my reverse-engineering suppose to have a signature
constructor(view: MarkdownView);
Similarly, while class MarkdownRenderer
is abstract and cannot be instantiated directly, it has the same problem as above with the misleading constructor, which would be another runtime error for child classes
class MyMarkdownRenderer extends MarkdownRenderer {
constructor(containerEl: HTMLElement) {
super(containerEl);
}
}
The actual constructor seems to be
constructor(app: App, containerEl: HTMLElement, shouldHandleNodeInsert?: boolean);