Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

Source

5 exports Since v4.0.0 Source

Extraction

Since v4.0.0

Extracts marked TypeScript code snippets from documentation text.

Details

Extraction uses an ordered text scan and does not parse the containing source file.

Signature

declare function extract(source: string, format: SourceFormat): readonly Array<Snippet>

Reads a file and extracts its marked code snippets.

Signature

declare function extractFile(file: string): Promise<readonly Array<Snippet>>

Guards

Returns whether a file uses Markdown or MDX documentation syntax.

Signature

declare function isMarkdown(file: string): boolean

Models

Snippet

interface
Since v4.0.0

Represents an executable TypeScript code snippet.

Signature

interface Snippet {
readonly line: number;
readonly name: string | undefined;
readonly source: string;
}
Since v4.0.0

Identifies how documentation is embedded in the source text.

Signature

type SourceFormat = "jsdoc" | "markdown"