Skip to content

MarkdownRenderer

Defined in: obsidian.d.ts:2485

Extends

Extended by

Implements

Constructors

new MarkdownRenderer()

new MarkdownRenderer(containerEl): MarkdownRenderer

Defined in: obsidian.d.ts:2479

Parameters

containerEl

HTMLElement

This HTMLElement will be used to test whether this component is still alive. It should be a child of the Markdown preview sections, and when it’s no longer attached (for example, when it is replaced with a new version because the user edited the Markdown source code), this component will be unloaded.

Returns

MarkdownRenderer

Inherited from

MarkdownRenderChild.constructor

Properties

_children

_children: Component[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:9

Child Components attached to current component, will be unloaded on unloading parent component

Implementation of

MarkdownPreviewEvents._children

Inherited from

MarkdownPreviewEvents._children


_events

_events: EventRef[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:13

Events that are attached to the current component, will be detached on unloading parent component

Implementation of

MarkdownPreviewEvents._events

Inherited from

MarkdownPreviewEvents._events


_loaded

_loaded: boolean

Defined in: src/obsidian/augmentations/Components/Component.d.ts:17

Whether the component and its children are loaded

Implementation of

MarkdownPreviewEvents._loaded

Inherited from

MarkdownPreviewEvents._loaded


app

app: App

Defined in: obsidian.d.ts:2487


containerEl

containerEl: HTMLElement

Defined in: obsidian.d.ts:2471

Inherited from

MarkdownRenderChild.containerEl


hoverPopover

hoverPopover: HoverPopover

Defined in: obsidian.d.ts:2490

Implementation of

HoverParent.hoverPopover

Inherited from

HoverParent.hoverPopover

Accessors

file

Get Signature

get abstract file(): TFile

Defined in: node_modules/obsidian/obsidian.d.ts:2493

Returns

TFile


path

Get Signature

get path(): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:6

Returns

unknown

Methods

addChild()

addChild<T>(component): T

Defined in: obsidian.d.ts:887

Adds a child component, loading it if this component is loaded

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Implementation of

MarkdownPreviewEvents.addChild

Inherited from

MarkdownPreviewEvents.addChild


load()

load(): void

Defined in: obsidian.d.ts:865

Load this component and its children

Returns

void

Implementation of

MarkdownPreviewEvents.load

Inherited from

MarkdownPreviewEvents.load


onCheckboxClick()

onCheckboxClick(e, n, i): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:7

Parameters

e

unknown

n

unknown

i

unknown

Returns

unknown


onFileChange()

onFileChange(e): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:8

Parameters

e

unknown

Returns

unknown


onFoldChange()

onFoldChange(): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:9

Returns

unknown


onload()

onload(): void

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:10

Override this to load your component

Returns

void

Implementation of

MarkdownPreviewEvents.onload

Inherited from

MarkdownPreviewEvents.onload


onRenderComplete()

onRenderComplete(): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:11

Returns

unknown


onScroll()

onScroll(): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:12

Returns

unknown


onunload()

onunload(): void

Defined in: obsidian.d.ts:882

Override this to unload your component

Returns

void

Implementation of

MarkdownPreviewEvents.onunload

Inherited from

MarkdownPreviewEvents.onunload


postProcess()

postProcess(e, t, n): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:13

Parameters

e

unknown

t

unknown

n

unknown

Returns

unknown


register()

register(cb): void

Defined in: obsidian.d.ts:897

Registers a callback to be called when unloading

Parameters

cb

() => any

Returns

void

Implementation of

MarkdownPreviewEvents.register

Inherited from

MarkdownPreviewEvents.register


registerDomEvent()

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:907

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof WindowEventMap

Parameters
el

Window

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Implementation of

MarkdownPreviewEvents.registerDomEvent

Inherited from

MarkdownPreviewEvents.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:912

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof DocumentEventMap

Parameters
el

Document

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Implementation of

MarkdownPreviewEvents.registerDomEvent

Inherited from

MarkdownPreviewEvents.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:917

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof HTMLElementEventMap

Parameters
el

HTMLElement

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Implementation of

MarkdownPreviewEvents.registerDomEvent

Inherited from

MarkdownPreviewEvents.registerDomEvent


registerEvent()

registerEvent(eventRef): void

Defined in: obsidian.d.ts:902

Registers an event to be detached when unloading

Parameters

eventRef

EventRef

Returns

void

Implementation of

MarkdownPreviewEvents.registerEvent

Inherited from

MarkdownPreviewEvents.registerEvent


registerInterval()

registerInterval(id): number

Defined in: obsidian.d.ts:924

Registers an interval (from setInterval) to be cancelled when unloading Use setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API

Parameters

id

number

Returns

number

Implementation of

MarkdownPreviewEvents.registerInterval

Inherited from

MarkdownPreviewEvents.registerInterval


registerScopeEvent()

registerScopeEvent(keymapEventHandler): void

Defined in: src/obsidian/augmentations/Components/Component.d.ts:19

Parameters

keymapEventHandler

KeymapEventHandler

Returns

void

Implementation of

MarkdownPreviewEvents.registerScopeEvent

Inherited from

MarkdownPreviewEvents.registerScopeEvent


removeChild()

removeChild<T>(component): T

Defined in: obsidian.d.ts:892

Removes a child component, unloading it

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Implementation of

MarkdownPreviewEvents.removeChild

Inherited from

MarkdownPreviewEvents.removeChild


resolveLinks(e): unknown

Defined in: src/obsidian/augmentations/MarkdownRenderer.d.ts:14

Parameters

e

unknown

Returns

unknown


unload()

unload(): void

Defined in: obsidian.d.ts:876

Unload this component and its children

Returns

void

Implementation of

MarkdownPreviewEvents.unload

Inherited from

MarkdownPreviewEvents.unload


render()

static render(app, markdown, el, sourcePath, component): Promise<void>

Defined in: obsidian.d.ts:2510

Renders Markdown string to an HTML element.

Parameters

app

App

A reference to the app object

markdown

string

The Markdown source code

el

HTMLElement

The element to append to

sourcePath

string

The normalized path of this Markdown file, used to resolve relative internal links

component

Component

A parent component to manage the lifecycle of the rendered child components.

Returns

Promise<void>


renderMarkdown()

static renderMarkdown(markdown, el, sourcePath, component): Promise<void>

Defined in: obsidian.d.ts:2500

Renders Markdown string to an HTML element.

Parameters

markdown

string

el

HTMLElement

sourcePath

string

component

Component

Returns

Promise<void>