Search code examples
botframeworkfacebook-messengerazure-bot-service

Markdown not rendering in messenger


I'm writing some simple markdown which is displaying correctly in the test window but when it renders in Facebook Messenger there is no rendering.

This is what is displayed plain text in messenger instead of the heading text

# This Is The Heading # 

And this is what is displayed plain text in messenger for the bold text

*Bold Stuff*    

This is the code that I'm using. As I said it works fine in the test window.

    StringBuilder sb = new StringBuilder();
    sb.AppendLine("# This Is The Heading  \n\n");
    sb.AppendLine("Some text    \n\n");
    sb.AppendLine("**Bold Stuff**    \n\n");
    sb.AppendLine("more text    \n\n");

    IMessageActivity reply = context.MakeMessage();
    reply.Text = sb.ToString();
    context.PostAsync(reply);

Solution

  • Answer from craigjensen:

    Messenger doesn't support markdown so we strip it and send the plain text. If/when Facebook starts supporting markdown we'll make the necessary updates to fully support it.

    Here: https://github.com/Microsoft/BotBuilder/issues/2033


    The Channel Inspector is a useful tool for seeing how different features are rendered on the different channels: https://docs.botframework.com/en-us/channel-inspector/channels/Facebook?f=Markdown&e=example1