My type: section
block looks pretty standard.
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "A message *with some bold text* and _some italicized text_."
}
}
I realized that Slack wraps lines longer than ~85 characters (I didn't bother to figure out the exact number). This is however not true for any messages I write myself into Slack (not via WebApi, no sure if it's treated as a block internally).
My question is: Can I stop Slack from wrapping lines that early? It looks ugly if there are lengthy lines of text conversations going on and suddenly there's a cropped bot message spreading over multiple lines - especially on large screens.
From your desktop, click the plus icon next to the message field. Search for and select Create a text snippet from the menu. Enter a title if you'd like, then choose a file type from the drop-down menu. Type or paste your snippet in the Content field.
Message attachments allow you to add richer formatting to messages, as well as interactive buttons and menus.
You must provide either a file or content parameter. The content of the file can either be posted using an enctype of multipart/form-data (with the file parameter named file ), in the usual way that files are uploaded via the browser, or the content of the file can be sent as a POST var called content .
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With