obsidian-dev-utils
Version:
This is the collection of useful functions that you can use for your Obsidian plugin development
25 lines (24 loc) • 1.12 kB
text/typescript
/**
* @packageDocumentation
*
* This module provides utility functions for processing code blocks in Obsidian.
*/
import type { App, MarkdownPostProcessorContext } from 'obsidian';
import type { ValueProvider } from '../ValueProvider.mjs';
/**
* Retrieves the argument of a code block from the given MarkdownPostProcessorContext and HTMLElement.
*
* @param ctx - The MarkdownPostProcessorContext object.
* @param el - The HTMLElement representing the code block.
* @returns The argument of the code block as a string, or null if no argument is found.
*/
export declare function getCodeBlockArguments(ctx: MarkdownPostProcessorContext, el: HTMLElement): string[];
/**
* Replaces the code block.
*
* @param app - The Obsidian App object.
* @param ctx - The MarkdownPostProcessorContext object.
* @param el - The HTMLElement representing the code block.
* @param codeBlockProvider - The ValueProvider that provides the new code block.
*/
export declare function replaceCodeBlock(app: App, ctx: MarkdownPostProcessorContext, el: HTMLElement, codeBlockProvider: ValueProvider<string, [string]>): Promise<void>;