concat-md
Version:
CLI and API to concatenate markdown files and modify as necessary.
72 lines (71 loc) • 2.13 kB
TypeScript
/** @ignore */
export declare function gitHubLink(val: string): string;
/**
* Concat function options.
*/
export interface ConcatOptions {
/**
* Whether to add a table of contents.
*/
toc?: boolean;
/**
* Limit TOC entries to headings only up to the specified level.
*/
tocLevel?: number;
/**
* Glob patterns to exclude in `dir`.
*/
ignore?: string | string[];
/**
* Whether to decrease levels of all titles in markdown file to set them below file and directory title levels.
*/
decreaseTitleLevels?: boolean;
/**
* Level to start file and directory levels.
*/
startTitleLevelAt?: number;
/**
* String to be used to join concatenated files.
*/
joinString?: string;
/**
* Key name to get title in `FrontMatter` meta data in markdown headers.
*/
titleKey?: string;
/**
* Whether to use file names as titles.
*/
fileNameAsTitle?: boolean;
/**
* Whether to use directory names as titles.
*/
dirNameAsTitle?: boolean;
/**
* Do not add anchor links
*/
hideAnchorLinks?: boolean;
/**
* Custom sort function. If not set, files are sorted alphabetically.
*/
sorter?: (a: string, b: string) => number;
}
/**
* Scans and concatenates all markdown files in given directory.
*
* @param dir is the directory to scan markdown files in.
* @param options are several parameters to modify concatenation behaviour.
* @returns concatenated contents of markdown files.
* @example
* import concatMd, { concatMdSync } from "concat-md"
*/
export declare function concatMdSync(dir: string, options?: ConcatOptions): string;
/**
* Scans and concatenates all markdown files in given directory.
*
* @param dir is the directory to scan markdown files in.
* @param options are several parameters to modify concatenation behaviour.
* @returns concatenated contents of markdown files.
* @example
* import concatMd, { concatMdSync } from "concat-md"
*/
export default function concatMd(dir: string, options?: ConcatOptions): Promise<string>;