Skip to content

Commit

Permalink
💡 Added logic to remove whitespace from the line (#1519)
Browse files Browse the repository at this point in the history
* added logic to remove whitespace from line

* added comment

* Update gatsby-node.js

Co-authored-by: Brady Stroud [SSW] <bradystroud@ssw.com.au>

---------

Co-authored-by: Brady Stroud [SSW] <bradystroud@ssw.com.au>
  • Loading branch information
babakamyljanovssw and bradystroud authored Oct 8, 2024
1 parent 263e50e commit 331d9a6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -33,6 +41,7 @@ exports.onCreateNode = ({ node, getNode, actions }) => {
});
}
};

exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions;
const typeDefs = `
Expand Down

0 comments on commit 331d9a6

Please sign in to comment.