From 2483aef69fa36b59ccb53cba23df08f10ac1e712 Mon Sep 17 00:00:00 2001 From: Nicholas Drane Date: Thu, 29 Nov 2018 21:56:42 -0600 Subject: [PATCH] fix(gatsby-transformer-remark): render html attributes in html excerpt (#10196) * track markdown properties * fix image markdown --- .../src/__tests__/__snapshots__/extend-node.js.snap | 2 +- .../gatsby-transformer-remark/src/__tests__/extend-node.js | 4 ++-- packages/gatsby-transformer-remark/src/hast-processing.js | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/gatsby-transformer-remark/src/__tests__/__snapshots__/extend-node.js.snap b/packages/gatsby-transformer-remark/src/__tests__/__snapshots__/extend-node.js.snap index 648fc80a20a74..9bed3f6306003 100644 --- a/packages/gatsby-transformer-remark/src/__tests__/__snapshots__/extend-node.js.snap +++ b/packages/gatsby-transformer-remark/src/__tests__/__snapshots__/extend-node.js.snap @@ -57,7 +57,7 @@ Object { exports[`Excerpt is generated correctly from schema given an html format, it correctly maps nested markdown to html 1`] = ` Object { - "excerpt": "

Where oh where is that pony?

", + "excerpt": "

Where oh where is \\"that?

", "frontmatter": Object { "title": "my little pony", }, diff --git a/packages/gatsby-transformer-remark/src/__tests__/extend-node.js b/packages/gatsby-transformer-remark/src/__tests__/extend-node.js index 7fd5a833895c0..938c6eb590405 100644 --- a/packages/gatsby-transformer-remark/src/__tests__/extend-node.js +++ b/packages/gatsby-transformer-remark/src/__tests__/extend-node.js @@ -245,7 +245,7 @@ title: "my little pony" date: "2017-09-18T23:19:51.246Z" --- -Where oh [*where*](nick.com) **_is_** that pony?`, +Where oh [*where*](nick.com) **_is_** ![that pony](pony.png)?`, `excerpt(format: HTML) frontmatter { title @@ -254,7 +254,7 @@ Where oh [*where*](nick.com) **_is_** that pony?`, node => { expect(node).toMatchSnapshot() expect(node.excerpt).toMatch( - `

Where oh where is that pony?

` + `

Where oh where is that pony?

` ) } ) diff --git a/packages/gatsby-transformer-remark/src/hast-processing.js b/packages/gatsby-transformer-remark/src/hast-processing.js index 46068438a9cff..b6d5ac9dbdeb8 100644 --- a/packages/gatsby-transformer-remark/src/hast-processing.js +++ b/packages/gatsby-transformer-remark/src/hast-processing.js @@ -4,6 +4,7 @@ function duplicateNode(node) { children: [], tagName: node.tagName, value: node.value, + properties: node.properties, } }