botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

How to insert Blank Lines?

Open b0yfriend opened this issue 10 years ago • 13 comments

How do I add blank lines in messages?

e.g.

blankno blankyes

b0yfriend avatar Aug 29 '16 15:08 b0yfriend

actually my question would be how to add a line break in skype chats. I have not been able to do that Adding \n to the line end gives me no line break Adding \n\n to the end of line, gives be a blank line like in here example 2. I would need to get smth like in here example 1, with just a simple line break. I am using "markdown" style in messages (I need to, since I need to parse hyperlinks)

liiver avatar Aug 29 '16 17:08 liiver

@liiver

"\n\n" gives you example 2? That's odd. "\n\n" gives me example 1.

For instance, doing

session.send("Hello\n\nWorld!");

gives me

"Hello World"

b0yfriend avatar Aug 29 '16 17:08 b0yfriend

i'm using C#, if that makes any difference but this is indeed the case for me

liiver avatar Aug 29 '16 17:08 liiver

I'm using node. That makes sense. It could be a difference in the language implementations

b0yfriend avatar Aug 29 '16 20:08 b0yfriend

End your sentence with two white-space and one \n. That would give you line break. For example

string response = "this is one line  \n"; // Notice two white space before \n
response += "next line";

ankitbko avatar Aug 30 '16 07:08 ankitbko

The break tag <br/> will also work.

gplumb avatar Aug 30 '16 12:08 gplumb

2 space and \n should work. " \n next line"

Sams4u avatar Aug 30 '16 13:08 Sams4u

@gplumb

I can confirm that using <br/><br/> produces a full, blank line (not just a line break).

However, <br> fails. It even spawned multiple runtime errors in my program.

So, to anyone reading this, you must include the "/" in <br/>.

Tested on:

  • Node.js
  • Skype

b0yfriend avatar Aug 30 '16 16:08 b0yfriend

The above solution only works for Skype.

Therefore, I am re-opening this issue for the other platforms. I confirm that it doesn't work for <iframe> and SMS via Twilio.

b0yfriend avatar Aug 30 '16 17:08 b0yfriend

similar to issue #920 and this should have the answer.

Also markup, e.g. <br/>, is only supported by Skype channel: https://github.com/Microsoft/BotBuilder/blob/c4dbb7183cc1c23837b6d6c8bc03fe8c54ba1f55/CSharp/Library/Microsoft.Bot.Connector/TextFormatTypes.cs#L22

msft-shahins avatar Sep 01 '16 00:09 msft-shahins

I am using REST APIs in python. For me " \n \n" <2 spaces followed by \n followed by another 2 spaces and a \n> generates a response in next line "HELLO \n \nWorld" generates the following in SfB (not sure if its the same for Skype) HELLO WORLD

Rohit573 avatar Nov 11 '17 13:11 Rohit573

@Rohit573 two white-space and one \n worked for SKype for business. Do you know how do we send Bold, Italic text to Skype for business . As it does nor support markdown and html.

ganesh1190 avatar Jan 18 '18 13:01 ganesh1190

@ganesh1190 SfB is absolutely cold hearted. It converts every thing to plain text. No BOLD, ITALICS, etc. (worked on this 1.5 months ago)

Rohit573 avatar Jan 18 '18 13:01 Rohit573