What I’m trying to do
I developed a simple plugin to show or hide meta yaml by css. There will be a bug The cursor gets stuck in the collapsed YAML zone due to hidden elements. Therefore, I want to prevent meta yaml regions from being generated when markdown rendering.
Things I have tried
I tried to use Replace decorations to hide meta yaml, but there will be many empty lines. So I would like to ask if there is an API that prevents nodes from rendering.
Here are my custom widget:
export class EmptyWidget extends WidgetType {
toDOM(view: EditorView): HTMLElement {
const div = document.createElement("span");
div.innerText = "";
return div;
}
}
Replace the sample code new EmojiWidget()
with new EmptyWidget()
.