3

Can line-wrapping be applied such that it is preferred that inline code isn't split across multiple lines?

Understandably this cannot always happen, consider when the code is longer than a line, but it would be nice if it at least mostly happened.

This is actually more of a problem in comments, since it's quite a bit more difficult to manually insert a line-break as I did below and needing keep editing it to get it right because of the lack of a preview.

Just to clarify, I know you can put code in a code block,
  which will, to my knowledge, never get line wrapped, you will simply get a scroll-bar

You obviously can't do this in comments though and sometimes inline code just makes more sense.

Example:

As an example, let's type some random text, a bit more random text, a little more, and then also some code, you can then notice that the code is split across the 2 lines.

In my opinion, it would be better (more readable) if it were to be split like this:

As an example, let's type some random text, a bit more random text, a little more, and then
also some code, you can then notice that the code is not split across the 2 lines.

  • This is my attempt at a comment where code is split across multiple lines (random filler text) some code which is split. – Dukeling Aug 7 '13 at 16:25
1

I tend to use references to $variables, etc. like this, but as far as lines of code go:

echo "I will format it like this.";

It doesn't seem like backticks are MEANT for large code snippets. If it becomes a severe readability issue, then you can line break manually on those rare occasions. Otherwise, consider not using the backticks and instead hop down to a new line, prefaced with four spaces.

  • I don't make them too long, but it's still a bit of a hassle in posts sometimes, and I can only imagine how difficult it is to read some of my comments with a few code samples (short, simple things like x = y) in because every second one gets split across lines. – Dukeling Aug 7 '13 at 16:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .