Skip to content

Commit 8a1cc8b

Browse files
author
Cayla Hamann
committed
chore: add closing tag and makes it one line
1 parent e9b1eb5 commit 8a1cc8b

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@newrelic/gatsby-theme-newrelic": "^1.32.1",
1313
"@splitsoftware/splitio-react": "^1.2.0",
1414
"babel-jest": "^26.3.0",
15+
"common-tags": "^1.8.0",
1516
"date-fns": "^2.16.1",
1617
"front-matter": "^4.0.2",
1718
"gatsby": "^2.32.0",
@@ -26,6 +27,7 @@
2627
"gatsby-remark-autolink-headers": "^2.7.0",
2728
"gatsby-remark-copy-linked-files": "^2.6.0",
2829
"gatsby-remark-images": "^3.11.0",
30+
"gatsby-remark-responsive-iframe": "^2.11.0",
2931
"gatsby-source-filesystem": "^2.7.0",
3032
"gatsby-transformer-json": "^2.9.0",
3133
"gatsby-transformer-remark": "^2.12.0",

plugins/gatsby-remark-videos/index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const visit = require('unist-util-visit');
22
const { parse } = require('node-html-parser');
3+
const { oneLine } = require('common-tags');
34

45
module.exports = ({ markdownAST }) => {
56
visit(markdownAST, 'html', (node) => {
@@ -13,14 +14,17 @@ module.exports = ({ markdownAST }) => {
1314
const src = element.getAttribute('src');
1415
const title = element.getAttribute('title');
1516

16-
node.value = `
17-
<div class="wistia_responsive_wrapper" style="padding: 56.25% 0 0 0; position: relative; height: 0;">
18-
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen src="${src}" title="${
17+
const rawHTML = oneLine`
18+
<div class="wistia_responsive_wrapper" style="padding: 56.25% 0 0 0; position: relative; height: 0;"><iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen src="${src}" title="${
1919
title || ''
20-
}" class="wistia_embed" frameborder="0" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;" />
21-
</div>
20+
}" class="wistia_embed" scrolling="no" frameborder="0" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;"></iframe></div>
2221
`.trim();
23-
console.log(node);
22+
23+
node.data = {
24+
hChildren: [{ type: `raw`, value: rawHTML }],
25+
};
26+
node.type = `unknown`;
27+
delete node.value;
2428
});
2529

2630
return markdownAST;

yarn.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8652,6 +8652,17 @@ gatsby-remark-images@^3.11.0:
86528652
unist-util-select "^1.5.0"
86538653
unist-util-visit-parents "^2.1.2"
86548654

8655+
gatsby-remark-responsive-iframe@^2.11.0:
8656+
version "2.11.0"
8657+
resolved "https://registry.yarnpkg.com/gatsby-remark-responsive-iframe/-/gatsby-remark-responsive-iframe-2.11.0.tgz#c5b68f06324138a31f85fdb5da5503ab812b5446"
8658+
integrity sha512-qqrYfUb4+9VhndBeEaKrhiyyKIReAK4BHL3/8ZCtFDem5ZQQd5pUdgYhExRLcoGxzwJrqVxI6+dtT/RoXLqC/g==
8659+
dependencies:
8660+
"@babel/runtime" "^7.12.5"
8661+
cheerio "^1.0.0-rc.3"
8662+
common-tags "^1.8.0"
8663+
lodash "^4.17.20"
8664+
unist-util-visit "^1.4.1"
8665+
86558666
gatsby-source-filesystem@^2.3.19:
86568667
version "2.3.24"
86578668
resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-2.3.24.tgz#857932fb91cba876ff1e48172103ead66cf2b0fe"

0 commit comments

Comments
 (0)