errbot
errbot copied to clipboard
prefix_groupchat is broken with markdown
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 ...
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?
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.