errbot icon indicating copy to clipboard operation
errbot copied to clipboard

prefix_groupchat is broken with markdown

Open gbin opened this issue 8 years ago • 2 comments

     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 ...

gbin avatar May 06 '16 16:05 gbin

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?

sijis avatar Jun 09 '16 13:06 sijis

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.

gbin avatar Jun 09 '16 16:06 gbin