Skip to content

Commit

Permalink
fix(gatsby-remark-images): Escape HTML characters for image caption (#…
Browse files Browse the repository at this point in the history
…14496)

* fix(gatsby-remark-images): Escape HTML characters for image caption

* Fix prettier style
  • Loading branch information
joshuaavalon authored and freiksenet committed Jun 25, 2019
1 parent 3e8578c commit 9fb78f8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/gatsby-remark-images/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,9 @@ module.exports = (
const fileNameNoExt = fileName.replace(/\.[^/.]+$/, ``)
const defaultAlt = fileNameNoExt.replace(/[^A-Z0-9]/gi, ` `)

const alt = overWrites.alt
? overWrites.alt
: node.alt
? node.alt
: defaultAlt
const alt = _.escape(
overWrites.alt ? overWrites.alt : node.alt ? node.alt : defaultAlt
)

const title = node.title ? node.title : ``

Expand Down

0 comments on commit 9fb78f8

Please sign in to comment.