microsoft / microsoft/BotFramework-WebChat
Using Markdown for outgoing messages
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 1.6k
- Avg merge
- 22h 58m
- Merged PRs (30d)
- 2
Description
Feature Request
Should we enable Markdown for outgoing messages?
More and more users are comfortable on sending Markdown, because WhatsApp and other messaging platform introduced it. For example, *abc* will emphasize the text "abc". And ~abc~ will cross it out.
Bot don't understand rich formatting, but human do, e.g. IC3 agents.
Today, when the user send a message, we explicitly mark the content as plain text, in sendMessageToPostActivitySaga.js.
Tomorrow, we could have a flag to turn Markdown on for outgoing messages. Or, we can default it to on and a flag to turn it back to plain text.
Sending hashes and limiting rules
After Markdown is enabled for outgoing messages, another thing would pop up.
If the user is sending "#", it will be parsed as <h1></h1> (header). Most people are unknown to this Markdown syntax. And it looks like they are sending blank message to the other side.
If the user is sending "# can be either pound or hash", it will be parsed as <h1>can be either pound or hash</h1>.
This could also affecting the line-break rules in Markdown.
If we enabled Markdown, should we enable it only for a certain set of rules? If yes, which rules?
List of rules supported by WhatsApp can be found here, https://faq.whatsapp.com/en/android/26000002. Only italics, bold, strikethrough, and monospace are supported.
For the MIME type, we could set it to text/markdown;variant=WhatsApp or text/markdown;variant=webchat-usersubset. But currently, we are using textFormat which only support plain, markdown, and xml only. BTW, CommonMark is text/markdown;variant=CommonMark.
[Enhancement]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at sendMessageToPostActivitySaga.js, where the issue says outgoing content is explicitly marked as plain text, and review the current textFormat options. Before implementation, resolve the desired Markdown subset, hash and line-break behavior, MIME variant, and whether Markdown is opt-in or the default; done means those behaviors and the configuration are agreed and implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, markdown
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100