Skip to content

MarkdownPreviewView

Defined in: obsidian.d.ts:2425

Extends

Implements

Constructors

new MarkdownPreviewView()

new MarkdownPreviewView(containerEl): MarkdownPreviewView

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

MarkdownPreviewView

Inherited from

MarkdownRenderer.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

Inherited from

MarkdownRenderer.app


containerEl

containerEl: HTMLElement

Defined in: obsidian.d.ts:2430

Overrides

MarkdownRenderer.containerEl


docId

docId: string

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

Unique identifier for the rendered element


hoverPopover

hoverPopover: HoverPopover

Defined in: obsidian.d.ts:2490

Inherited from

MarkdownRenderer.hoverPopover


renderer

renderer: ReadViewRenderer

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:15

HTML renderer for the Markdown


search: unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:16


type

type: string

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:17


view

view: MarkdownView

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:18

Accessors

file

Get Signature

get file(): TFile

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

Returns

TFile

Overrides

MarkdownRenderer.file


path

Get Signature

get path(): unknown

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

Returns

unknown

Inherited from

MarkdownRenderer.path

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


applyFoldInfo()

applyFoldInfo(e): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:20

Parameters

e

unknown

Returns

unknown


applyScroll()

applyScroll(scroll): void

Defined in: obsidian.d.ts:2462

Parameters

scroll

number

Returns

void

Implementation of

MarkdownSubView.applyScroll

Inherited from

MarkdownSubView.applyScroll


beforeUnload()

beforeUnload(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:21

Returns

unknown


clear()

Call Signature

clear(): void

Defined in: obsidian.d.ts:2448

Returns

void

Call Signature

clear(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:25

Clears the rendered preview

Returns

unknown


edit()

edit(e): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:26

Parameters

e

unknown

Returns

unknown


foldAll()

foldAll(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:27

Returns

unknown


get()

Call Signature

get(): string

Defined in: obsidian.d.ts:2440

Returns

string

Implementation of

MarkdownSubView.get

Inherited from

MarkdownSubView.get

Call Signature

get(): string

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:31

Returns the renderer text

Returns

string

Implementation of

MarkdownSubView.get


getEphemeralState()

getEphemeralState(e): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:32

Parameters

e

unknown

Returns

unknown


getFoldInfo()

getFoldInfo(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:33

Returns

unknown


getScroll()

getScroll(): number

Defined in: obsidian.d.ts:2458

Returns

number

Implementation of

MarkdownSubView.getScroll

Inherited from

MarkdownSubView.getScroll


getSelection()

getSelection(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:34

Returns

unknown


hide()

hide(): void

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:35

Returns

void


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

Inherited from

MarkdownRenderer.onCheckboxClick


onFileChange()

onFileChange(e): unknown

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

Parameters

e

unknown

Returns

unknown

Inherited from

MarkdownRenderer.onFileChange


onFoldChange()

onFoldChange(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:36

Returns

unknown

Inherited from

MarkdownRenderer.onFoldChange


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/MarkdownPreviewView.d.ts:37

Returns

unknown

Inherited from

MarkdownRenderer.onRenderComplete


onResize()

onResize(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:38

Returns

unknown


onScroll()

onScroll(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:39

Returns

unknown

Inherited from

MarkdownRenderer.onScroll


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

Inherited from

MarkdownRenderer.postProcess


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


requestUpdateLinks(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:40

Returns

unknown


rerender()

rerender(full?): void

Defined in: obsidian.d.ts:2453

Parameters

full?

boolean

Returns

void


resolveLinks(e): unknown

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

Parameters

e

unknown

Returns

unknown

Inherited from

MarkdownRenderer.resolveLinks


set()

Call Signature

set(data, clear): void

Defined in: obsidian.d.ts:2444

Parameters
data

string

clear

boolean

Returns

void

Implementation of

MarkdownSubView.set

Inherited from

MarkdownSubView.set

Call Signature

set(data, clear): void

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:46

Set the Preview to new data

Parameters
data

string

The data to set the renderer to

clear

boolean

If the preview should be cleared

Returns

void

Implementation of

MarkdownSubView.set


setEphemeralState()

setEphemeralState(e): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:47

Parameters

e

unknown

Returns

unknown


show()

show(): void

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:48

Returns

void


showSearch()

showSearch(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:49

Returns

unknown


unfoldAll()

unfoldAll(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:50

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


updateOptions()

updateOptions(): unknown

Defined in: src/obsidian/augmentations/MarkdownPreviewView.d.ts:51

Returns

unknown


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>

Inherited from

MarkdownRenderer.render


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>

Inherited from

MarkdownRenderer.renderMarkdown