UNPKG

2.05 kBTypeScriptView Raw
1import { Language } from '../..';
2import { DocsSchema } from '../schema';
3/**
4 * Options for defining a markdown header.
5 */
6export interface MarkdownHeaderOptions {
7 /**
8 * Title to be displayed.
9 */
10 readonly title?: string;
11 /**
12 * Superscript.
13 *
14 * @default - No superscript
15 */
16 readonly sup?: string;
17 /**
18 * Preformat the header.
19 *
20 * @default false
21 */
22 readonly pre?: boolean;
23 /**
24 * Strikethough the title.
25 *
26 * @default false
27 */
28 readonly strike?: boolean;
29}
30/**
31 * Options for defining a markdown element.
32 */
33export interface MarkdownOptions {
34 /**
35 * Markdown header.
36 *
37 * @default - No header.
38 */
39 readonly header?: MarkdownHeaderOptions;
40 /**
41 * Id of the element.
42 *
43 * @default - The title will be used.
44 */
45 readonly id?: string;
46}
47/**
48 * Markdown element.
49 */
50export declare class MarkdownDocument {
51 private readonly options;
52 /**
53 * An empty markdown element.
54 */
55 static readonly EMPTY: MarkdownDocument;
56 /**
57 * Sanitize markdown reserved characters from external input.
58 */
59 static sanitize(line: string): string;
60 /**
61 * Remove newlines from markdown.
62 */
63 static removeNewlines(line: string): string;
64 static bold(text: string): string;
65 static pre(text: string): string;
66 static italic(text: string): string;
67 private readonly _lines;
68 private readonly _sections;
69 private readonly id?;
70 private readonly header?;
71 constructor(options?: MarkdownOptions);
72 /**
73 * Render a docs element into the markdown.
74 */
75 docs(docs: DocsSchema, language?: Language): void;
76 table(data: string[][]): void;
77 quote(line: string): void;
78 bullet(line: string): void;
79 code(language: string, ...snippet: string[]): void;
80 lines(...lines: string[]): void;
81 split(): void;
82 section(section: MarkdownDocument): void;
83 render(headerSize?: number): string;
84 private formatHeader;
85 private escapePipes;
86}