Skip to content

Workspace.on('markdown-viewport-menu') method

Workspace › on(‘markdown-viewport-menu’)

Unofficial

Triggers when the markdown viewport menu is opened.

Signature:

on(name: "markdown-viewport-menu", callback: (menu: Menu, view: MarkdownView, mode: MarkdownViewModeType, source: LiteralStringUnion<"gutter">) => unknown, ctx?: unknown): EventRef

Parameters:

ParameterTypeDescription
name"markdown-viewport-menu"'markdown-viewport-menu'.
callback(menu: Menu, view: MarkdownView, mode: MarkdownViewModeType, source: LiteralStringUnion<"gutter">) => unknownCallback function.
ctx?unknownContext.

Returns: EventRefEvent reference.

Remarks:

The callback's mode is the view mode the menu was opened in; source is the part of the viewport that opened it. Obsidian's own handler compares mode against 'source' to decide whether the Line numbers toggle applies.