Skip to content

ReadViewRenderer

Unofficial

Renderer for the reading/preview view, managing section-based markdown rendering.

Import:

import type { ReadViewRenderer } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface ReadViewRenderer

Properties

PropertyTypeDescription
addBottomPaddingbooleanWhether to add bottom padding to the preview.
asyncSectionsunknown[]Sections that are being rendered asynchronously.
footernull | RendererSectionThe .mod-footer.mod-ui section rendered after the content, or null when the renderer has none.
headernull | RendererSectionThe .mod-header.mod-ui section rendered before the content, or null when the renderer has none.
lastRendernumberTimestamp of the last render operation.
lastScrollnumberLast recorded scroll position.
lastTextnull | stringText content from the last render, or null when the next render must not reuse it.
previewElHTMLElementContainer element for the rendered preview.
pusherElHTMLElementElement used to push content for scroll height calculation.
recycledSectionsunknown[]Pool of recycled section elements for reuse.
rendered(() => void)[] | nullCallbacks waiting for the pending render to complete, or null when no render is pending.
sectionsRendererSection[]All sections in the rendered document.
sizerElHTMLElementThe .markdown-preview-sizer element that holds the rendered sections.
textstringCurrent text content being rendered.

Methods

MethodReturnsDescription
addFooter()voidAdd the footer section, if the renderer has none yet.
addHeader()voidAdd the header section, if the renderer has none yet.
clear()voidClear all rendered sections and reset the renderer.
onRendered(callback)voidRun a callback after the pending render completes, or immediately when no render is pending.
parseAsync()voidParse the text content asynchronously into sections.
parseSync()voidParse the text content synchronously into sections.
queueRender()voidQueue a render update for the next animation frame.
removeFooter()voidRemove the footer section, if the renderer has one.
removeHeader()voidRemove the header section, if the renderer has one.
rerender(full?)voidRender the text again.
set(text)voidSet the text content and trigger a re-render.
updateFooter()voidRe-measure the footer section and queue a render. Call it after changing the footer's content.
updateHeader()voidRe-measure the header section and queue a render. Call it after changing the header's content.

Links to this page: