0

I've a url which contains a hypen . This hypen breaks the way url is displayed and does not let the URL to be properly displayed in the markdown format as shown below

HTML

Please  <a href="https://abcd.service-now.com" target="_blank"> click here </a> to view RITM details on Service Now.

Markdown

Please [click here](https://abcd.service- now.com) to view RITM details on Service Now.

I usually generate the link from constants and turn it into HTML anchor tag and then convert it to MarkDown using html2text. What do I do to not let the URL split so that it's properly shown in markdown. The markdown is meant for displaying on Bot Framework Web Chat control

Vijay
  • 1,030
  • 11
  • 34
  • 1
    I noticed a space after the hyphen in your example above and then checked your source text (via edit) and noticed that there is a line break at that location. I expect that if you remove the line break from the middle of the URL you will not have problem. – Waylan Jun 04 '18 at 17:34
  • Yes, I observed this at the time of writing the question. But in my constants module, I specify them with '''triple quotes''' which should not break the lines. – Vijay Jun 04 '18 at 18:20
  • 1
    It was not clear to me from your question where the line break was being introduced. My assumption was that you introduced the line break when formatting the question. May I suggest that you edit your question to include the output in a preformatted code block rather than a quoteblock and make it clear exactly what is being returned by the tool. I realize the quoteblock makes the problem evident (so you may want to keep it), but it doesn't make it clear if the problem is user error or something else. Unfortunately, I have no experience with the tools you are using, so that's all I got. – Waylan Jun 04 '18 at 19:45

1 Answers1

1

You can try to directly send the markdown format string in botbuilder in python. And which is also support in webchat as mentioned at Channel Inspector.

I have a test with hypen link and it works fine on my side.

def __create_reply_activity(request_activity):
        return Activity(
            type=ActivityTypes.message,
            channel_id=request_activity.channel_id,
            conversation=request_activity.conversation,
            recipient=request_activity.from_property,
            from_property=request_activity.recipient,
            text='[Click here](https://bing-well.com)',
            service_url=request_activity.service_url)

enter image description here

Gary Liu
  • 13,758
  • 1
  • 17
  • 32
  • 1
    I am forced to use HTML since styling in HTML is a bit easy - atleast for me. As far as the new line with hypen, I had to take your approach using the MarkDown after wasting a lot of time to identify the new line character. Accepted. – Vijay Jun 05 '18 at 07:23