Question

Multiple spaces in code block

  • 27 March 2020
  • 3 replies
  • 149 views

Userlevel 1
  • Ready to take it to the next level
  • 5 replies

Multiple spaces in code blocks are merged into one space after publishing an article. This messes up the formatting of source code. Is this a known issue and/or is there a workaround available?

On editing:

 

After publishing:

 


3 replies

Userlevel 1

Hi,

Just started using Insided and saw your question. I haven’t used any of the features (or code blocks) yet - but from your screenshots it looks like you are editing raw html with multiple spaces. HTML itself doesn’t inherently allow for multiple consecutive spacing I’m afraid (it will always compress it into one space as demonstrated).

I don’t know what options there are for formatting as haven’t used an insided code block yet - however if there are <pre> tags available, that will preserve whatever formatting is in the text within that tag, including whitespaces. Usually used for code snippets etc

Alternatively, you can use &nbsp; to denote a ‘non-breaking space’ and these can be strung together. to create multiple spaces. It makes editing quite difficult though and only really suitable for use ‘here and there’. not a very elegant solution

You may be able to do something with CSS classes - e.g. using nested ul/li elements and hiding the bullet points. 

Userlevel 1

Hi Alo, 

I’m aware that HTML doesn’t show consecutive spaces, but I’m using the integrated code editor. It seems like double spaces are stripped from the source code when saving an article already, because the code is displayed inside in a pre element and only contains single spaces:

  @Julian Do you have any suggestions?

Userlevel 7
Badge +1

Hi Jasper,

thanks for flagging this here. Sorry it took me a while to respond, still working through a huge backlog as I was out of office for a while…

So there is already a bug ticket for this to be fixed, it has been confirmed to be a bug in the editor. Hopefully it will be working just fine again soon, unfortunately I have no indication yet as to when this will be fixed. But I will update this thread once I see relevant information in the ticket.

Reply