errbotio / errbot

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
http://errbot.io
GNU General Public License v3.0
3.13k stars 616 forks source link

prefix_groupchat is broken with markdown #742

Closed gbin closed 9 months ago

gbin commented 8 years ago
     def prefix_groupchat_reply(self, message: Message, identifier: Identifier):
        if message.body.startswith('#'):
            # Markdown heading, insert an extra newline to ensure the
            # markdown rendering doesn't break.
            message.body = "\n" + message.body

ok .. but what about about everything else that it can break: tables, codeblocks, lines, lists ...

sijis commented 8 years ago

If I understand, there are other markdown (lists, tables, etc) that can begin with a # and thus could break formatting.

To be clear, this occurs when a plugin is sending markdown as a response?

gbin commented 8 years ago

the output of a plugin command is always markdown now. I think like for the message cutting bug, it needs to be aware of the markdown structure so it needs to be implemented on the "rendering" of the markdown (the transformation from markdown to whatever formatting language a backend uses).

This process is quite pluggable (you can insert filters at every stage etc) so we can imagine a filter saying : insert that as a prefix and the renderer will know what to do with it.