Code formatting

Do all the various “code” types have the same rules for wrapping long lines?

And does the browser platform (i.e. mobile vs desktop) affect it?

Seems that some posts that use the code formatting have the long lines wrapped, while others dont. I personally find it easier to follow the program flow when there is no wrapping.

If you actually use the format shown above the editor on desktop view, it formats the code properly for all devices.
It should be the ``` on its own line.

Okay … seems the wrapping rule (on what chars to break) was throwing me off. Take the examples below:

/* three ticks, with no language specified.  This comment is really, really, really, really, really, really,  long and wraps to the next line */

/*this_comment_is_long_but_with_no_breakable_characters_._It_uses_underscores_which_dont_seem_to_break*/

/*this.comment.is.long.but.with.no.breakable.characters...It.uses.dots.which.don't.seem.to.break*/

// the following line of psuedocode has no breakable chars (no spaces around the equals sign)
obj.child1.grandchild.greatgrandchild.element.subelement=otherobj.child1.grandchild.greatgrandchild.element.subelement;

// the following is the same as the line above, but with a space on each side of the equals sign
obj.child1.grandchild.greatgrandchild.element.subelement = otherobj.child1.grandchild.greatgrandchild.element.subelement;

One more thing… I thought I saw some posts with code in the text, with a “Copy” button you could click to copy the text of the code to the clipboard.

Though that might have been another site (like Github).

If it is available here, how is it done?

It was removed. A bug made it unusable apparently. I really miss that little button. @josecgomez

1 Like