Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Non-breaking space in HTML block

  • #6364
    Avatar photo[anonymous]

    Hi,

    I’m using HTML block in Block Editor and tried to include the non-breaking space character (&nbsp;) in a paragraph to keep two words together in a <p> block. However, instead of a space between the two words, it shows an ampersand character.

    Alternatively, if I used the WYSIWYG Editor’s “HTML Source code”, the non-breaking space character (&nbsp;) gets stripped but replaced by normal space.

    Is there a work-around?

    Thanks

    #6401
    Avatar photo[anonymous]

    Hi,

    It seems that some filtering does bad job with &nbsp; entities. I will need to fix it in the next release.

    Temporary solution can be use of & # 160; entity (remove spaces from it) – it works for me 🙂

    #6404
    Avatar photo[anonymous]

    Thanks for the workaround, Tomasz.

    #6837
    Avatar photo[anonymous]

    Hi there,

    to my own testing both & # 160; and & nbsp; work.
    However, these entities do not show up when you once again hit the HTML mode button, they are gone, invisible or something. Yet nbsp keeps working until you further edit the paragraph. Adding a single space after the nbsp’ed text is enough to revert the nbsp’s, no matter which method you used.

    #6838
    Avatar photo[anonymous]
    [anonymous] wrote:

    Hi there,

    to my own testing both & # 160; and & nbsp; work.

    However, these entities do not show up when you once again hit the HTML mode button, they are gone, invisible or something. Yet nbsp keeps working until you further edit the paragraph. Adding a single space after the nbsp’ed text is enough to revert the nbsp’s, no matter which method you used.

    That’s weird. On my setup, the HTML non-breaking space ( &nbsp; ) code stays in place after saving the page. You can check it with DevTools turned on in Publii (with the DevTools parked at the bottom of the screen rather than the side). Then select the element to ‘zoom in’.

    I’m using I guess what might be called a ‘standard setup’– that is: the current latest Publii v.0.38.3 (build 14238) under Apple macOS Monterey, v12.2.

    So maybe there’s some issue with your setup.

    #6851
    Avatar photo[anonymous]

    Hi there,

    a great 1-minute-solution for the WYSIWIG editor has been provided by Bob in Post 6 of this Github issue:

    https://github.com/GetPublii/Publii/issues/1062