Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
chore: add closing tag and makes it one line
Browse files Browse the repository at this point in the history
  • Loading branch information
Cayla Hamann committed Feb 26, 2021
1 parent e9b1eb5 commit 8a1cc8b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@newrelic/gatsby-theme-newrelic": "^1.32.1",
"@splitsoftware/splitio-react": "^1.2.0",
"babel-jest": "^26.3.0",
"common-tags": "^1.8.0",
"date-fns": "^2.16.1",
"front-matter": "^4.0.2",
"gatsby": "^2.32.0",
Expand All @@ -26,6 +27,7 @@
"gatsby-remark-autolink-headers": "^2.7.0",
"gatsby-remark-copy-linked-files": "^2.6.0",
"gatsby-remark-images": "^3.11.0",
"gatsby-remark-responsive-iframe": "^2.11.0",
"gatsby-source-filesystem": "^2.7.0",
"gatsby-transformer-json": "^2.9.0",
"gatsby-transformer-remark": "^2.12.0",
Expand Down
16 changes: 10 additions & 6 deletions plugins/gatsby-remark-videos/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const visit = require('unist-util-visit');
const { parse } = require('node-html-parser');
const { oneLine } = require('common-tags');

module.exports = ({ markdownAST }) => {
visit(markdownAST, 'html', (node) => {
Expand All @@ -13,14 +14,17 @@ module.exports = ({ markdownAST }) => {
const src = element.getAttribute('src');
const title = element.getAttribute('title');

node.value = `
<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="${
const rawHTML = oneLine`
<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="${
title || ''
}" class="wistia_embed" frameborder="0" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;" />
</div>
}" class="wistia_embed" scrolling="no" frameborder="0" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;"></iframe></div>
`.trim();
console.log(node);

node.data = {
hChildren: [{ type: `raw`, value: rawHTML }],
};
node.type = `unknown`;
delete node.value;
});

return markdownAST;
Expand Down
11 changes: 11 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8652,6 +8652,17 @@ gatsby-remark-images@^3.11.0:
unist-util-select "^1.5.0"
unist-util-visit-parents "^2.1.2"

gatsby-remark-responsive-iframe@^2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/gatsby-remark-responsive-iframe/-/gatsby-remark-responsive-iframe-2.11.0.tgz#c5b68f06324138a31f85fdb5da5503ab812b5446"
integrity sha512-qqrYfUb4+9VhndBeEaKrhiyyKIReAK4BHL3/8ZCtFDem5ZQQd5pUdgYhExRLcoGxzwJrqVxI6+dtT/RoXLqC/g==
dependencies:
"@babel/runtime" "^7.12.5"
cheerio "^1.0.0-rc.3"
common-tags "^1.8.0"
lodash "^4.17.20"
unist-util-visit "^1.4.1"

gatsby-source-filesystem@^2.3.19:
version "2.3.24"
resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-2.3.24.tgz#857932fb91cba876ff1e48172103ead66cf2b0fe"
Expand Down

0 comments on commit 8a1cc8b

Please sign in to comment.