MarkdownRenderer
Extends
Extended by
Implements
Constructors
new MarkdownRenderer()
new MarkdownRenderer(
containerEl
):MarkdownRenderer
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
Inherited from
MarkdownRenderChild
.constructor
Properties
_children
_children:
Component
[]
Child Components attached to current component, will be unloaded on unloading parent component
Implementation of
MarkdownPreviewEvents
._children
Inherited from
MarkdownPreviewEvents
._children
_events
_events:
EventRef
[]
Events that are attached to the current component, will be detached on unloading parent component
Implementation of
Inherited from
_loaded
_loaded:
boolean
Whether the component and its children are loaded
Implementation of
Inherited from
app
app:
App
containerEl
containerEl:
HTMLElement
Inherited from
MarkdownRenderChild
.containerEl
hoverPopover
hoverPopover:
HoverPopover
Implementation of
Inherited from
Accessors
file
get
abstract
file():TFile
Returns
path
get
path():unknown
Returns
unknown
Methods
addChild()
addChild<
T
>(component
):T
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
Load this component and its children
Returns
void
Implementation of
Inherited from
onCheckboxClick()
onCheckboxClick(
e
,n
,i
):unknown
Parameters
• e: unknown
• n: unknown
• i: unknown
Returns
unknown
onFileChange()
onFileChange(
e
):unknown
Parameters
• e: unknown
Returns
unknown
onFoldChange()
onFoldChange():
unknown
Returns
unknown
onload()
onload():
void
Override this to load your component
Returns
void
Implementation of
Inherited from
onRenderComplete()
onRenderComplete():
unknown
Returns
unknown
onScroll()
onScroll():
unknown
Returns
unknown
onunload()
onunload():
void
Override this to unload your component
Returns
void
Implementation of
MarkdownPreviewEvents
.onunload
Inherited from
MarkdownPreviewEvents
.onunload
postProcess()
postProcess(
e
,t
,n
):unknown
Parameters
• e: unknown
• t: unknown
• n: unknown
Returns
unknown
register()
register(
cb
):void
Registers a callback to be called when unloading
Parameters
• cb
Returns
void
Implementation of
MarkdownPreviewEvents
.register
Inherited from
MarkdownPreviewEvents
.register
registerDomEvent()
registerDomEvent(el, type, callback, options)
registerDomEvent<
K
>(el
,type
,callback
,options
?):void
Registers an DOM event to be detached when unloading
Type Parameters
• K extends keyof WindowEventMap
Parameters
• el: Window
• type: K
• callback
• options?: boolean
| AddEventListenerOptions
Returns
void
Implementation of
MarkdownPreviewEvents
.registerDomEvent
Inherited from
MarkdownPreviewEvents
.registerDomEvent
registerDomEvent(el, type, callback, options)
registerDomEvent<
K
>(el
,type
,callback
,options
?):void
Registers an DOM event to be detached when unloading
Type Parameters
• K extends keyof DocumentEventMap
Parameters
• el: Document
• type: K
• callback
• options?: boolean
| AddEventListenerOptions
Returns
void
Implementation of
MarkdownPreviewEvents
.registerDomEvent
Inherited from
MarkdownPreviewEvents
.registerDomEvent
registerDomEvent(el, type, callback, options)
registerDomEvent<
K
>(el
,type
,callback
,options
?):void
Registers an DOM event to be detached when unloading
Type Parameters
• K extends keyof HTMLElementEventMap
Parameters
• el: HTMLElement
• type: K
• callback
• options?: boolean
| AddEventListenerOptions
Returns
void
Implementation of
MarkdownPreviewEvents
.registerDomEvent
Inherited from
MarkdownPreviewEvents
.registerDomEvent
registerEvent()
registerEvent(
eventRef
):void
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
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
Parameters
• keymapEventHandler: KeymapEventHandler
Returns
void
Implementation of
MarkdownPreviewEvents
.registerScopeEvent
Inherited from
MarkdownPreviewEvents
.registerScopeEvent
removeChild()
removeChild<
T
>(component
):T
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()
resolveLinks(
e
):unknown
Parameters
• e: unknown
Returns
unknown
unload()
unload():
void
Unload this component and its children
Returns
void
Implementation of
Inherited from
render()
static
render(app
,markdown
,el
,sourcePath
,component
):Promise
<void
>
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
>
Renders Markdown string to an HTML element.
Parameters
• markdown: string
• el: HTMLElement
• sourcePath: string
• component: Component
Returns
Promise
<void
>