No. Slack makes it own decision on when to wrap lines, mostly depending on the current client and platform.
There are no configuration options or markups to change that behavior like white-space: nowrap;
with CSS.
But of course your can force line breaks with \n
in your text strings.
Further clarification
The reason why you have different line breaks in your example is that Slack is handling simple text posts differently then blocks and attachments.
If you post a simple message the text will use the full width of your screen. That is the same behavior as when you make a post manually.
Example:
{
"channel": "blueberry",
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
}
However, if you post a layout blocks or attachments those are always formatted to a certain max width. My guess is that Slack does that, so all blocks nicely line up with each other, but I do not know this for sure. Anyways, as said before this behavior can not be configured.
{
"channel": "blueberry",
"blocks":
[
{
"type": "section",
"text":
{
"type": "mrkdwn",
"text": " Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
}
}
]
}
So, if you want your post to use the full length of the screen, just don't use blocks and post as a normal message instead.