replaceCodeBlock
Replaces the code block.
Obsidian renders the block again from its new source. To keep the focus or plugin state across that render, pass ReplaceCodeBlockParams.shouldCarryFocusToNextRender or ReplaceCodeBlockParams.nextRenderState, and call claimCodeBlockRenderHandoff from the processor. When the note is open in an editor, Obsidian applies the write as one change the user can undo.
Import:
import { replaceCodeBlock } from '@mnaoumov/obsidian-lib/markdown-code-block-processor';Signature:
function replaceCodeBlock(params: ReplaceCodeBlockParams): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
params |
ReplaceCodeBlockParams | The parameters for the function. |
Links to this page: