Skip to content

Commit

Permalink
fix(gatsby-transformer-remark): render html attributes in html excerpt (
Browse files Browse the repository at this point in the history
#10196)

* track markdown properties

* fix image markdown
  • Loading branch information
nadrane authored and DSchau committed Nov 30, 2018
1 parent 71d7f23 commit 2483aef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<p>Where oh <a><em>where</em></a> <strong><em>is</em></strong> that pony?</p>",
"excerpt": "<p>Where oh <a href=\\"nick.com\\"><em>where</em></a> <strong><em>is</em></strong> <img src=\\"pony.png\\" alt=\\"that pony\\">?</p>",
"frontmatter": Object {
"title": "my little pony",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -254,7 +254,7 @@ Where oh [*where*](nick.com) **_is_** that pony?`,
node => {
expect(node).toMatchSnapshot()
expect(node.excerpt).toMatch(
`<p>Where oh <a><em>where</em></a> <strong><em>is</em></strong> that pony?</p>`
`<p>Where oh <a href="nick.com"><em>where</em></a> <strong><em>is</em></strong> <img src="pony.png" alt="that pony">?</p>`
)
}
)
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby-transformer-remark/src/hast-processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function duplicateNode(node) {
children: [],
tagName: node.tagName,
value: node.value,
properties: node.properties,
}
}

Expand Down

0 comments on commit 2483aef

Please sign in to comment.