Skip to content

isOwnedByRenderedMarkdown

Whether an element belongs to the markdown rendered into rootEl, rather than to a Reading view or a Bases view nested inside it (an embed), which handles its own events. A port of Obsidian’s static MarkdownPreviewRenderer.belongsToMe, which obsidian-typings does not declare.

Import:

import { isOwnedByRenderedMarkdown } from '@mnaoumov/obsidian-lib/rendered-markdown';

Signature:

function isOwnedByRenderedMarkdown(element: Element, rootEl: HTMLElement): boolean

Parameters:

Parameter Type Description
element Element The element an event landed on.
rootEl HTMLElement The element markdown was rendered into.

Returns: boolean — Whether the element is rootEl itself or sits inside it with no nested view in between.