diff --git a/package.json b/package.json index b50df0a5acf..65c54dcd34e 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/plugins/gatsby-remark-videos/index.js b/plugins/gatsby-remark-videos/index.js index 4c6222ebea3..87071560de1 100644 --- a/plugins/gatsby-remark-videos/index.js +++ b/plugins/gatsby-remark-videos/index.js @@ -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) => { @@ -13,14 +14,17 @@ module.exports = ({ markdownAST }) => { const src = element.getAttribute('src'); const title = element.getAttribute('title'); - node.value = ` -
-
`.trim(); - console.log(node); + + node.data = { + hChildren: [{ type: `raw`, value: rawHTML }], + }; + node.type = `unknown`; + delete node.value; }); return markdownAST; diff --git a/yarn.lock b/yarn.lock index 3e14ecf647b..37edd6b7b6b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"