question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gatsby-plugin-mdx randomly inserts non breaking spaces

See original GitHub issue

Description

Some lines (text) are not properly broken up on when using MDX. This is especially annoying on mobile, where the lines will run out of the screen. When looking into the generated html, these lines have   instead of regular spaces. I can’t find anything odd or specific in our markdown that could trigger this.

Steps to reproduce

  1. Clone demo: https://github.com/joeplaa/gatsby-mdx-repro-31559
  2. Install and run develop
  3. Browse to article “Hoeveel btw zit er op iZettle diensten?” (top of page)
  4. Search for “Je zou misschien denken”
  5. Open devtools in Chrome (or equivalent in other browser) and view element with text from search above. It shows it is rendered as: Je zou misschien denken dat je deze uitgaven dan helemaal niet in 

image

Expected result

MDX/markdown/Gatsby should not insert non breaking spaces. Instead it should only insert normal spaces.

Actual result

Multiple lines contain non breaking spaces without explicitly having typed them.

Environment

  System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1245 v3 @ 3.40GHz
  Binaries:
    Node: 12.21.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 2.7.15 - /c/Users/Joepje/.windows-build-tools/python27/python
  Browsers:
    Edge: Spartan (44.19041.964.0), Chromium (90.0.818.66)
  npmPackages:
    gatsby: ^3.4.1 => 3.4.1 
    gatsby-plugin-mdx: ^2.5.1 => 2.5.1 
    gatsby-source-filesystem: ^3.5.0 => 3.5.0 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
umortenbcommented, Aug 5, 2021

I just had a similar problem, and noticed that content pasted to a CMS from Microsoft Word contained non breaking spaces, which look exactly the same as normal spaces, but get converted differently. They are visible through small dots when marking them in VSCode: image

0reactions
joeplaacommented, Aug 10, 2021

Thanks @umbiermann, that solved my problem too!!! We initially copied all our existing posts from WordPress to Gatsby and some of those posts were indeed originally written in Microsoft Word, which explains where those non-breaking spaces come from. Apparently WordPress is less strict when it comes to displaying them.

@LekoArts, I’ll close this issue as my problem is solved and this is not, strictly speaking, a Gatsby issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-plugin-mdx
gatsby -plugin-mdx is the official integration for using MDX with Gatsby. MDX is markdown for the component era. It lets you write JSX...
Read more >
Non-Breaking Space Randomly Inserting Upon Saving ...
Every time I save my document, a non-breaking space is inserting before a specific word. Maybe someone using the system created a shortcut....
Read more >
Creating New Gatsby Theme with Typescript, MDX, and ...
Gatsby Themes provide a powerful way to share an opinionated set of configurations across multiple Gatsby sites.
Read more >
Tags | Katie Kodes
Jitterbit: replace a non-breaking space (07 Oct 2022); Jitterbit: backfill Salesforce ID into a database (13 Sep 2022); Can eProcurement reach Banner?
Read more >
100DaysOfGatsby - Paul Scanlon
Once the UI part is done i hope to be investigating a source plugin which will be great as it's not something i've...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found