diff --git a/src/_parse.ts b/src/_parse.ts index 30a7b67..c5cbd8a 100644 --- a/src/_parse.ts +++ b/src/_parse.ts @@ -2,13 +2,38 @@ import { destr } from "destr"; import { camelCase } from "scule"; export interface Block { + /** + * The name of the generator to use for updates. + */ generator: string; + + /** + * The arguments that are passed to the generator. + */ rawArgs: string; + + /** + * The current content of the block. + */ contents: string; + + /** + * The location of the content in the original document. + */ loc: { start: number; end: number }; + + /** + * The location including the automd comments. + */ _loc: { start: number; end: number }; } +/** + * Searches a markdown document for special sections that `automd` can update. + * + * @param md - The markdown document as a string. + * @returns an array of blocks that can be updated automatically. {@link Block} + */ export function findBlocks(md: string): Block[] { const blocks: Block[] = []; @@ -36,10 +61,27 @@ export function findBlocks(md: string): Block[] { return blocks; } +/** + * Checks if a markdown document contains sections that can be automatically updated. + * + * @param md - The markdown document as a string. + * @returns true if there are `automd` sections, false otherwise. + */ export function containsAutomd(md: string) { return /^