UNPKG

obsidian-dev-utils

Version:

This is the collection of useful functions that you can use for your Obsidian plugin development

58 lines (57 loc) 1.67 kB
/** * @packageDocumentation * * This module provides utility functions for rendering callouts in Dataview. */ import type { MaybeReturn } from '../Type.cjs'; import type { ValueProvider } from '../ValueProvider.cjs'; import type { DataviewInlineApi } from './Dataview.cjs'; /** * Enum representing the mode of a callout. */ export declare enum CalloutMode { /** Default mode, with no special behavior. */ Default = 0, /** Foldable mode with the callout collapsed. */ FoldableCollapsed = 1, /** Foldable mode with the callout expanded. */ FoldableExpanded = 2 } /** * Options for rendering a callout block in Dataview. */ export interface RenderCalloutOptions { /** * An optional provider for the content, which can be either a string or a Node. */ contentProvider?: ValueProvider<MaybeReturn<Node | string>>; /** * The DataviewInlineApi instance. */ dv: DataviewInlineApi; /** * The header text of the callout, default is an empty string. */ header?: string; /** * The callout mode, default is `CalloutMode.FoldableCollapsed`. */ mode?: CalloutMode; /** * The type of the callout, default is `"NOTE"`. */ type?: string; } /** * Renders a callout block in Dataview. * * @param options - The options for rendering the callout. */ export declare function renderCallout(options: RenderCalloutOptions): void; /** * Wraps the provided content in blockquote syntax for a callout. * * @param content - The content to wrap. * @returns The content wrapped in blockquote syntax. */ export declare function wrapForCallout(content: string): string;