Skip to content

Commit 39d982d

Browse files
authored
fix(index): trim the output html to fix support in mdx (#13)
1 parent 5c6c5c5 commit 39d982d

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

specs/__snapshots__/index.specs.js.snap

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ Object {
162162
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
163163
</div>
164164
</div>
165-
</div>
166-
",
165+
</div>",
167166
}
168167
`;
169168
@@ -211,8 +210,7 @@ Object {
211210
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
212211
</div>
213212
</div>
214-
</div>
215-
",
213+
</div>",
216214
}
217215
`;
218216
@@ -260,8 +258,7 @@ Object {
260258
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
261259
</div>
262260
</div>
263-
</div>
264-
",
261+
</div>",
265262
}
266263
`;
267264
@@ -1203,8 +1200,7 @@ Object {
12031200
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
12041201
</div>
12051202
</div>
1206-
</div>
1207-
",
1203+
</div>",
12081204
}
12091205
`;
12101206
@@ -1252,8 +1248,7 @@ Object {
12521248
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
12531249
</div>
12541250
</div>
1255-
</div>
1256-
",
1251+
</div>",
12571252
}
12581253
`;
12591254
@@ -1301,8 +1296,7 @@ Object {
13011296
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
13021297
</div>
13031298
</div>
1304-
</div>
1305-
",
1299+
</div>",
13061300
}
13071301
`;
13081302
@@ -2244,8 +2238,7 @@ Object {
22442238
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
22452239
</div>
22462240
</div>
2247-
</div>
2248-
",
2241+
</div>",
22492242
}
22502243
`;
22512244
@@ -2293,8 +2286,7 @@ Object {
22932286
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
22942287
</div>
22952288
</div>
2296-
</div>
2297-
",
2289+
</div>",
22982290
}
22992291
`;
23002292
@@ -2342,8 +2334,7 @@ Object {
23422334
hosted with &#10084; by <a href=\\"https://github.com\\">GitHub</a>
23432335
</div>
23442336
</div>
2345-
</div>
2346-
",
2337+
</div>",
23472338
}
23482339
`;
23492340

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ function buildUrl(value, options, file) {
113113
export default async ({ markdownAST }, options = {}) => {
114114
// this returns a promise that will fulfill immediately for everything
115115
// that is not an inlineCode that starts with `gist:`
116-
return await visit(markdownAST, async node => {
116+
return await visit(markdownAST, "inlineCode", async node => {
117117
// validate pre-requisites.
118-
if (node.type !== "inlineCode" || !node.value.startsWith("gist:")) return;
118+
if (!node.value.startsWith("gist:")) return;
119119

120120
// get the query string and build the url
121121
const query = getQuery(node.value.substring(5));
@@ -138,7 +138,7 @@ export default async ({ markdownAST }, options = {}) => {
138138
}
139139

140140
node.type = "html";
141-
node.value = html;
141+
node.value = html.trim();
142142

143143
return markdownAST;
144144
});

0 commit comments

Comments
 (0)