Skip to content

@pumpkin-plugins/docs API / blocks / applyBlocks

Function: applyBlocks() ​

applyBlocks(text, blocks, file, note?): string

Defined in: tools/docs/src/blocks.ts:15

Replaces the content between <!-- docs:begin NAME --> and <!-- docs:end NAME --> for each entry in blocks. A block the text doesn't contain is skipped, so a README can opt out of a section by leaving its markers out.

Parameters ​

text ​

string

The README.

blocks ​

Record<string, string>

New content by block name.

file ​

string

The README's path, for error messages.

note? ​

string = GENERATED_NOTE

The comment to put at the top of each block.

Returns ​

string

The README with the blocks replaced.

Throws ​

When a block's markers are unbalanced, duplicated or out of order.

Pumpkin Plugins documentation