Skip to content

Commit bbfec16

Browse files
committed
Add examples to readme.md
1 parent 2aa6557 commit bbfec16

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

readme.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Transform [MDAST][] to [NLCST][].
44

5-
> **Note** You probably want to use [`remark-retext`][remark-retext].
5+
> **Note**: You probably want to use [`remark-retext`][remark-retext].
66
77
## Installation
88

@@ -77,12 +77,67 @@ List of node [types][type] to ignore (`Array.<string>`).
7777

7878
List of node [types][type] to mark as [source][] (`Array.<string>`).
7979

80-
`'inlineCode'` is always ignored.
80+
`'inlineCode'` is always marked as source.
8181

8282
##### Returns
8383

8484
[`NLCSTNode`][nlcst].
8585

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+
86141
## Related
87142

88143
* [`remark-retext`][remark-retext]

0 commit comments

Comments
 (0)