Nonbreaking space character being replaced with standard space

I’m trying to add some   entities in some text on a custom About page. However when I save the page they appear to get replaced by standard spaces.

Anyone experienced this or worked out how to fix it? Thanks.

Most Markdown parsers will replace &nbsp; with a space. You may want to try <code> &nbsp;</code> or <pre>&nbsp;</pre> to preserve white space.

See my personal site for the use of <pre> to preserve whitespace.

Thanks @jsonbecker, but I’m not sure that solves my issue. It’s not code or preformatted text. I’m trying to use &nbsp; as an actual nonbreaking space, to force a pair of words to stay together when wrapping.

I did some experimentation just now, and you’re correct that the HTML entity &nbsp; is replaced. But, from what I can tell, it’s replaced with a non-break space Unicode character: U+00A0. Not a standard space U+0020.

So, at least it should work as intended and keep the words together. :blush: @manton can probably elaborate if the entity being replaced is intended behavior or not.

1 Like

Thanks. That’s interesting. I’m using it to try to join an svg icon and a word. Maybe that just doesn’t work. I’ll try to get the FontAwesome plug-in to work and see if it works with an i tag. Though I couldn’t get that to display anything earlier.

Thanks for the tip. :slight_smile:

Okay, are you maybe talking about the links with SVG icons on your about page? You could solve that with custom CSS, like this:

a:has(svg) {
  white-space: nowrap;
1 Like

Perfect! Thank you.