Skip to content

getBasesControllerFromRender

Unofficial

Render a base into a detached, off-screen element and return the live obsidian#QueryController 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<QueryController>

Parameters:

Parameter Type Description
app App The app instance.
content string The .base file content (the body of a base code block).
sourcePath string The path supplying the query’s file context.
component Component The component that owns the render; the caller unloads it.

Returns: Promise<QueryController> — The live obsidian#QueryController for the rendered base.


Links to this page: