Skip to main content

Plugin_2

Extends Component

Constructor

constructor(app: App, manifest: PluginManifest);

Properties

app

app: App

manifest

manifest: PluginManifest

Methods

addRibbonIcon

addRibbonIcon(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;

Adds a ribbon icon to the left bar.

addStatusBarItem

addStatusBarItem(): HTMLElement;

addCommand

addCommand(command: Command): Command;

Register a command globally. The command id and name will be automatically prefixed with this plugin's id and name.

addSettingTab

addSettingTab(settingTab: PluginSettingTab): void;

registerView

registerView(type: string, viewCreator: ViewCreator): void;

registerHoverLinkSource

registerHoverLinkSource(id: string, info: HoverLinkSource): void;

Register your view with the 'Page preview' core plugin as an emitter of the 'hover-link' on the event.

registerExtensions

registerExtensions(extensions: string[], viewType: string): void;

registerMarkdownPostProcessor

registerMarkdownPostProcessor(postProcessor: MarkdownPostProcessor, sortOrder?: number): MarkdownPostProcessor;

registerMarkdownCodeBlockProcessor

registerMarkdownCodeBlockProcessor(language: string, handler: (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise<any> | void, sortOrder?: number): MarkdownPostProcessor;

Register a special post processor that handles fenced code given a language and a handler. This special post processor takes care of removing the <pre><code> and create a <div> that will be passed to your handler, and is expected to be filled with your custom elements.

registerCodeMirror

registerCodeMirror(callback: (cm: CodeMirror.Editor) => any): void;

Runs callback on all currently loaded instances of CodeMirror, then registers the callback for all future CodeMirror instances.

registerEditorExtension

registerEditorExtension(extension: Extension): void;

Registers a CodeMirror 6 extension. To reconfigure cm6 extensions for your plugin on the fly, you can pass an array here and dynamically modify it. Once this array is modified, call Workspace.updateOptions() to have the changes applied.

registerObsidianProtocolHandler

registerObsidianProtocolHandler(action: string, handler: ObsidianProtocolHandler): void;

Register a handler for obsidian:// URLs.

registerEditorSuggest

registerEditorSuggest(editorSuggest: EditorSuggest<any>): void;

Register an EditorSuggest which can provide live suggestions while the user is typing.

loadData

loadData(): Promise<any>;

saveData

saveData(data: any): Promise<void>;