File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ const {
1010 sourceNodeChanges,
1111} = require ( 'gatsby-graphql-source-toolkit' )
1212const { createRemoteFileNode } = require ( 'gatsby-source-filesystem' )
13+ const he = require ( 'he' )
1314const fetch = require ( 'node-fetch' )
1415
1516exports . onPreBootstrap = ( { reporter } , pluginOptions ) => {
@@ -149,16 +150,18 @@ exports.onCreateNode = async (
149150
150151 if ( fields . length ) {
151152 fields . forEach ( ( field ) => {
153+ const decodedMarkdown = he . decode ( field . markdown )
154+
152155 const markdownNode = {
153156 id : `MarkdownNode:${ createNodeId ( node . id ) } ` ,
154157 parent : node . id ,
155158 internal : {
156159 type : `GraphCMS_MarkdownNode` ,
157160 mediaType : 'text/markdown' ,
158- content : field . markdown ,
161+ content : decodedMarkdown ,
159162 contentDigest : crypto
160163 . createHash ( `md5` )
161- . update ( field . markdown )
164+ . update ( decodedMarkdown )
162165 . digest ( `hex` ) ,
163166 } ,
164167 }
Original file line number Diff line number Diff line change 1515 "dependencies" : {
1616 "gatsby-graphql-source-toolkit" : " 0.2.2" ,
1717 "gatsby-source-filesystem" : " 2.3.18" ,
18+ "he" : " 1.2.0" ,
1819 "node-fetch" : " 2.6.0"
1920 }
2021}
Original file line number Diff line number Diff line change @@ -7179,6 +7179,11 @@ hastscript@^5.0.0:
71797179 property-information "^5.0.0"
71807180 space-separated-tokens "^1.0.0"
71817181
7182+ he@1.2.0:
7183+ version "1.2.0"
7184+ resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
7185+ integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
7186+
71827187header-case@^1.0.0:
71837188 version "1.0.1"
71847189 resolved "https://registry.yarnpkg.com/header-case/-/header-case-1.0.1.tgz#9535973197c144b09613cd65d317ef19963bd02d"
You can’t perform that action at this time.
0 commit comments