From 331d9a64ba766a6634f26cbdb642e8d27fc01ff8 Mon Sep 17 00:00:00 2001 From: "Babanazar Kamyljanov [SSW]" <138548013+babakamyljanovssw@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:22:36 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A1=20Added=20logic=20to=20remove=20wh?= =?UTF-8?q?itespace=20from=20the=20line=20(#1519)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added logic to remove whitespace from line * added comment * Update gatsby-node.js Co-authored-by: Brady Stroud [SSW] --------- Co-authored-by: Brady Stroud [SSW] --- gatsby-node.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gatsby-node.js b/gatsby-node.js index f208ba837..992408d76 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -25,6 +25,14 @@ let assetsManifest = {}; exports.onCreateNode = ({ node, getNode, actions }) => { const { createNodeField } = actions; if (node.internal.type === 'MarkdownRemark') { + // TODO: Workaround - The issue is being tracked on the Gatsby side - https://github.com/gatsbyjs/gatsby/issues/39136 + const trimmedContent = node.internal.content + .split('\n') + .map((line) => (line.trim() === '' ? '' : line)) + .join('\n'); + + node.internal.content = trimmedContent; + const slug = createFilePath({ node, getNode, basePath: '' }); createNodeField({ node, @@ -33,6 +41,7 @@ exports.onCreateNode = ({ node, getNode, actions }) => { }); } }; + exports.createSchemaCustomization = ({ actions }) => { const { createTypes } = actions; const typeDefs = `