File tree Expand file tree Collapse file tree 5 files changed +26
-3
lines changed Expand file tree Collapse file tree 5 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,14 @@ var own = {}.hasOwnProperty;
9
9
function one ( h , node , parent ) {
10
10
var fn = null ;
11
11
12
- if ( node . type === 'element' && own . call ( h . handlers , node . tagName ) ) {
13
- fn = h . handlers [ node . tagName ] ;
12
+ if ( node . type === 'element' ) {
13
+ if ( node . properties && node . properties . dataMdast === 'ignore' ) {
14
+ return ;
15
+ }
16
+
17
+ if ( own . call ( h . handlers , node . tagName ) ) {
18
+ fn = h . handlers [ node . tagName ] ;
19
+ }
14
20
} else if ( own . call ( h . handlers , node . type ) ) {
15
21
fn = h . handlers [ node . type ] ;
16
22
}
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ An implicit sentence.
87
87
# An explicit sentence.
88
88
```
89
89
90
- ###### Ignored nodes
90
+ ###### Ignoring nodes
91
91
92
92
Some nodes are ignored and their content will not be present in MDAST.
93
93
To ignore custom elements, configure a handler for their tag-name or type that
@@ -104,6 +104,18 @@ Yields:
104
104
**Importance** and .
105
105
```
106
106
107
+ To ignore a specific element from HTML, set ` data-mdast ` to ` ignore ` :
108
+
109
+ ``` html
110
+ <p ><strong >Importance</strong > and <em data-mdast =" ignore" >emphasis</em >.</p >
111
+ ```
112
+
113
+ Yields:
114
+
115
+ ``` markdown
116
+ **Importance** and .
117
+ ```
118
+
107
119
## Related
108
120
109
121
* [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ]
Original file line number Diff line number Diff line change
1
+ < p > < strong > Importance</ strong > and < em data-mdast ="ignore "> emphasis</ em > .</ p >
Original file line number Diff line number Diff line change
1
+ {
2
+ "fragment" : true
3
+ }
Original file line number Diff line number Diff line change
1
+ ** Importance** and .
You can’t perform that action at this time.
0 commit comments