Skip to content

Commit fe9be6f

Browse files
committed
Add support for ignoring <area>, <map>
1 parent 238d294 commit fe9be6f

File tree

8 files changed

+27
-8
lines changed

8 files changed

+27
-8
lines changed

lib/handlers/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ exports.root = require('./root');
66
exports.text = require('./text');
77
exports.comment = require('./comment');
88

9+
exports.area =
910
exports.caption =
1011
exports.colgroup =
1112
exports.head =
13+
exports.map =
1214
exports.math =
1315
exports.script =
1416
exports.style =

test/fixtures/area/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<area shape="circle" coords="75,75,75" href="left.html" alt="Click to go Left">

test/fixtures/area/index.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"fragment": true
3+
}

test/fixtures/area/index.md

Whitespace-only changes.

test/fixtures/map/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<map name="primary">
2+
<area shape="circle" coords="75,75,75" href="left.html" alt="Click to go Left">
3+
<area shape="circle" coords="275,75,75" href="right.html" alt="Click to go Right">
4+
</map>
5+
<img usemap="#primary" src="http://placehold.it/350x150" alt="350 x 150 pic">

test/fixtures/map/index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"fragment": true,
3+
"document": true
4+
}

test/fixtures/map/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
![350 x 150 pic](http://placehold.it/350x150)

test/index.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ test('core', function (t) {
9191
});
9292

9393
test('fixtures', function (t) {
94-
var fromHTML = unified()
95-
.use(html)
96-
.use(function () {
97-
return toMDAST;
98-
})
99-
.use(stringify);
100-
10194
var remark = unified().use(markdown).use(stringify);
10295

10396
fs
@@ -121,7 +114,17 @@ test('fixtures', function (t) {
121114
config = JSON.parse(config);
122115
}
123116

124-
var tree = remove(fromHTML.runSync(fromHTML.parse(input, config)), true);
117+
var fromHTML = unified()
118+
.use(html)
119+
.use(function () {
120+
return transformer;
121+
function transformer(tree) {
122+
return toMDAST(tree, config);
123+
}
124+
})
125+
.use(stringify);
126+
127+
var tree = remove(fromHTML.runSync(fromHTML.parse(input)), true);
125128

126129
/* Replace middots with spaces (useful for break nodes). */
127130
output = output.replace(/·/g, ' ');

0 commit comments

Comments
 (0)