Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡 Added logic to remove whitespace from the line #1519

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

babakamyljanovssw
Copy link
Member

@babakamyljanovssw babakamyljanovssw commented Sep 30, 2024

cc: @bradystroud @Calinator444 @tkapa @BrookJeynes

Relates to #1448

Added logic to gatsby-node.js to remove whitespace from lines that contains only whitespace.
Then tested yarn build with new logic and without it.

For testing created test-sample-content branch in content repo, and added intentional whitespace to the rule.

image
Figure: Line 67 contains a whitespace

As result:

  • ✅ build is successful with new logic
  • ❌ build fails without new logic, and the error message was same that we have seen in recent workflow failures.

image
Figure: Build fails without new logic


🤖 Copilot's summary

This pull request includes changes to the gatsby-node.js file to improve the handling of Markdown content and streamline the code.

Content handling improvements:

  • gatsby-node.js: Added logic to trim empty lines from the Markdown content before processing. This ensures that unnecessary whitespace is removed, leading to cleaner content handling.

Codebase simplification:

  • gatsby-node.js: Added a new line after the onCreateNode function for better readability and separation of concerns.

@bradystroud
Copy link
Member

bradystroud commented Sep 30, 2024

This PR is awesome ⁠

I know the fix was super simple, but i think its worth making a Done Video since it could help other people

  1. Create an issue on the Gatsby repo for this problem (link to the PR to show how you fixed it)
  2. Add a TODO comment with a link to the issue
  3. Record a video showing the problem and how you fixed it

@babakamyljanovssw
Copy link
Member Author

Hi @bradystroud

✅ All done

Issue on gatsby repo - gatsbyjs/gatsby#39136
Video - https://youtu.be/tfoEjDFW-U0

bradystroud
bradystroud previously approved these changes Oct 8, 2024
gatsby-node.js Outdated Show resolved Hide resolved
Co-authored-by: Brady Stroud [SSW] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants