1 | import type { DocParagraph } from '../nodes';
|
2 | /**
|
3 | * Helper functions that transform DocNode trees.
|
4 | */
|
5 | export declare class DocNodeTransforms {
|
6 | /**
|
7 | * trimSpacesInParagraphNodes() collapses extra spacing characters from plain text nodes.
|
8 | *
|
9 | * @remarks
|
10 | * This is useful when emitting HTML, where any number of spaces are equivalent
|
11 | * to a single space. It's also useful when emitting Markdown, where spaces
|
12 | * can be misinterpreted as an indented code block.
|
13 | *
|
14 | * For example, we might transform this:
|
15 | *
|
16 | * ```
|
17 | * nodes: [
|
18 | * { kind: PlainText, text: " Here are some " },
|
19 | * { kind: SoftBreak }
|
20 | * { kind: PlainText, text: " words" },
|
21 | * { kind: SoftBreak }
|
22 | * { kind: InlineTag, text: "{\@inheritDoc}" },
|
23 | * { kind: PlainText, text: "to process." },
|
24 | * { kind: PlainText, text: " " },
|
25 | * { kind: PlainText, text: " " }
|
26 | * ]
|
27 | * ```
|
28 | *
|
29 | * ...to this:
|
30 | *
|
31 | * ```
|
32 | * nodes: [
|
33 | * { kind: PlainText, text: "Here are some " },
|
34 | * { kind: PlainText, text: "words " },
|
35 | * { kind: InlineTag, text: "{\@inheritDoc}" },
|
36 | * { kind: PlainText, text: "to process." }
|
37 | * ]
|
38 | * ```
|
39 | *
|
40 | * Note that in this example, `"words "` is not merged with the preceding node because
|
41 | * its DocPlainText.excerpt cannot span multiple lines.
|
42 | *
|
43 | * @param docParagraph - a DocParagraph containing nodes to be transformed
|
44 | * @returns The transformed child nodes.
|
45 | */
|
46 | static trimSpacesInParagraph(docParagraph: DocParagraph): DocParagraph;
|
47 | }
|
48 | //# sourceMappingURL=DocNodeTransforms.d.ts.map |
\ | No newline at end of file |