Skip to content

getBasesControllerFromRender

Unofficial

Render a base into a detached, off-screen element and return the live BasesController that drives it. This is the leaf-free route to headless base evaluation: it runs Obsidian’s own base-embed processor via the public obsidian#MarkdownRenderer.render, then locates the controller in the render’s component tree.

The caller owns component’s lifecycle and MUST call component.unload() once done with the controller (which also detaches the rendered element).

Import:

import { getBasesControllerFromRender } from '@obsidian-typings/obsidian-public-latest/implementations';

Signature:

function getBasesControllerFromRender(app: App, content: string, sourcePath: string, component: Component): Promise<BasesController>

Parameters:

ParameterTypeDescription
appAppThe app instance.
contentstringThe .base file content (the body of a base code block).
sourcePathstringThe path supplying the query’s file context.
componentComponentThe component that owns the render; the caller unloads it.

Returns: Promise<BasesController> — The live BasesController for the rendered base.


Links to this page: