5

The standard editor for posts seems to have problem with non-word-breakable code blocks above a certain length.

If such a 'word' is present in the editor, inserting spaces before it to create a code block will sneakily add a newline character to wrap it to a new line. If otherwise 4 spaces are added to a line first, such a long 'word' can safely be added (copied or typed) and will break to a new line without an extra newline character.

I tested this on the following sites:

The exact threshold is 81 characters, but it will be reduced by three characters, if the editor pane is required to show a scrollbar.

Below is an example of such a breakable code block. To test it yourself, edit this question and remove and type (not paste) the spaces before the example text, then copy the source contents between the two horizontal lines into any other text editor. You should recognize that it now contains three newlines although there were only two originally and you did not type another one.


This_text_consists_of_exactly_81_characters_and_does_not_include_a_word_boundary.

I cannot reasonably confirm, but it seems that this is a bug of the interface only, as it is possible to create a working source in various other ways. Nevertheless it is extremely specific and therefore easily avoidable - not to mention that there is also the ``` syntax.

You must log in to answer this question.

Browse other questions tagged .