|
2 | 2 |
|
3 | 3 | Transform [MDAST][] to [NLCST][].
|
4 | 4 |
|
5 |
| -> **Note** You probably want to use [`remark-retext`][remark-retext]. |
| 5 | +> **Note**: You probably want to use [`remark-retext`][remark-retext]. |
6 | 6 |
|
7 | 7 | ## Installation
|
8 | 8 |
|
@@ -77,12 +77,67 @@ List of node [types][type] to ignore (`Array.<string>`).
|
77 | 77 |
|
78 | 78 | List of node [types][type] to mark as [source][] (`Array.<string>`).
|
79 | 79 |
|
80 |
| -`'inlineCode'` is always ignored. |
| 80 | +`'inlineCode'` is always marked as source. |
81 | 81 |
|
82 | 82 | ##### Returns
|
83 | 83 |
|
84 | 84 | [`NLCSTNode`][nlcst].
|
85 | 85 |
|
| 86 | +##### Examples |
| 87 | + |
| 88 | +###### `ignore` |
| 89 | + |
| 90 | +Say we have the following file `example.md`: |
| 91 | + |
| 92 | +```markdown |
| 93 | +A paragraph. |
| 94 | + |
| 95 | +> A paragraph in a block quote. |
| 96 | +``` |
| 97 | + |
| 98 | +…and if we now transform with `ignore: ['blockquote']`, we get: |
| 99 | + |
| 100 | +```txt |
| 101 | +RootNode[2] (1:1-3:1, 0-14) |
| 102 | +├─ ParagraphNode[1] (1:1-1:13, 0-12) |
| 103 | +│ └─ SentenceNode[4] (1:1-1:13, 0-12) |
| 104 | +│ ├─ WordNode[1] (1:1-1:2, 0-1) |
| 105 | +│ │ └─ TextNode: "A" (1:1-1:2, 0-1) |
| 106 | +│ ├─ WhiteSpaceNode: " " (1:2-1:3, 1-2) |
| 107 | +│ ├─ WordNode[1] (1:3-1:12, 2-11) |
| 108 | +│ │ └─ TextNode: "paragraph" (1:3-1:12, 2-11) |
| 109 | +│ └─ PunctuationNode: "." (1:12-1:13, 11-12) |
| 110 | +└─ WhiteSpaceNode: "\n\n" (1:13-3:1, 12-14) |
| 111 | +``` |
| 112 | + |
| 113 | +###### `source` |
| 114 | + |
| 115 | +Say we have the following file `example.md`: |
| 116 | + |
| 117 | +```markdown |
| 118 | +A paragraph. |
| 119 | + |
| 120 | +> A paragraph in a block quote. |
| 121 | +``` |
| 122 | + |
| 123 | +…and if we now transform with `source: ['blockquote']`, we get: |
| 124 | + |
| 125 | +```txt |
| 126 | +RootNode[3] (1:1-3:32, 0-45) |
| 127 | +├─ ParagraphNode[1] (1:1-1:13, 0-12) |
| 128 | +│ └─ SentenceNode[4] (1:1-1:13, 0-12) |
| 129 | +│ ├─ WordNode[1] (1:1-1:2, 0-1) |
| 130 | +│ │ └─ TextNode: "A" (1:1-1:2, 0-1) |
| 131 | +│ ├─ WhiteSpaceNode: " " (1:2-1:3, 1-2) |
| 132 | +│ ├─ WordNode[1] (1:3-1:12, 2-11) |
| 133 | +│ │ └─ TextNode: "paragraph" (1:3-1:12, 2-11) |
| 134 | +│ └─ PunctuationNode: "." (1:12-1:13, 11-12) |
| 135 | +├─ WhiteSpaceNode: "\n\n" (1:13-3:1, 12-14) |
| 136 | +└─ ParagraphNode[1] (3:1-3:32, 14-45) |
| 137 | + └─ SentenceNode[1] (3:1-3:32, 14-45) |
| 138 | + └─ SourceNode: "> A paragraph in a block quote." (3:1-3:32, 14-45) |
| 139 | +``` |
| 140 | + |
86 | 141 | ## Related
|
87 | 142 |
|
88 | 143 | * [`remark-retext`][remark-retext]
|
|
0 commit comments