kotaindah55_extended-markdo.../main.ts
2025-02-03 20:08:31 +02:00

25 lines
No EOL
967 B
TypeScript

import { Plugin } from "obsidian";
import { EditorView } from "@codemirror/view";
// import { drawSelection } from "@codemirror/view";
import { parserField } from "src/editor-mode/state-fields";
import { editorExtendedSyntax } from "src/editor-mode/extensions";
import { PreviewExtendedSyntax } from "src/preview-mode/post-processor";
export default class ExtendedMarkdownSyntax extends Plugin {
async onload() {
await this.loadData();
this.registerEditorExtension([
// state fields
parserField,
// view plugins
editorExtendedSyntax,
// facet
EditorView.outerDecorations.of(view => view.plugin(editorExtendedSyntax)!.outerDecoSet)
]);
this.registerMarkdownPostProcessor(new PreviewExtendedSyntax().postProcess);
console.log("Load Extended Markdown Syntax");
}
onunload(): void {
console.log("Unload Extended Markdown Syntax");
}
}