UNPKG

2.13 kBTypeScriptView Raw
1/** @ignore */
2export declare function gitHubLink(val: string): string;
3/**
4 * Concat function options.
5 */
6export interface ConcatOptions {
7 /**
8 * Whether to add a table of contents.
9 */
10 toc?: boolean;
11 /**
12 * Limit TOC entries to headings only up to the specified level.
13 */
14 tocLevel?: number;
15 /**
16 * Glob patterns to exclude in `dir`.
17 */
18 ignore?: string | string[];
19 /**
20 * Whether to decrease levels of all titles in markdown file to set them below file and directory title levels.
21 */
22 decreaseTitleLevels?: boolean;
23 /**
24 * Level to start file and directory levels.
25 */
26 startTitleLevelAt?: number;
27 /**
28 * String to be used to join concatenated files.
29 */
30 joinString?: string;
31 /**
32 * Key name to get title in `FrontMatter` meta data in markdown headers.
33 */
34 titleKey?: string;
35 /**
36 * Whether to use file names as titles.
37 */
38 fileNameAsTitle?: boolean;
39 /**
40 * Whether to use directory names as titles.
41 */
42 dirNameAsTitle?: boolean;
43 /**
44 * Do not add anchor links
45 */
46 hideAnchorLinks?: boolean;
47 /**
48 * Custom sort function. If not set, files are sorted alphabetically.
49 */
50 sorter?: (a: string, b: string) => number;
51}
52/**
53 * Scans and concatenates all markdown files in given directory.
54 *
55 * @param dir is the directory to scan markdown files in.
56 * @param options are several parameters to modify concatenation behaviour.
57 * @returns concatenated contents of markdown files.
58 * @example
59 * import concatMd, { concatMdSync } from "concat-md"
60 */
61export declare function concatMdSync(dir: string, options?: ConcatOptions): string;
62/**
63 * Scans and concatenates all markdown files in given directory.
64 *
65 * @param dir is the directory to scan markdown files in.
66 * @param options are several parameters to modify concatenation behaviour.
67 * @returns concatenated contents of markdown files.
68 * @example
69 * import concatMd, { concatMdSync } from "concat-md"
70 */
71export default function concatMd(dir: string, options?: ConcatOptions): Promise<string>;