err-backend-mattermost icon indicating copy to clipboard operation
err-backend-mattermost copied to clipboard

markdown support

Open sokratisg opened this issue 8 years ago • 10 comments

First of all thank you very much for all the hard work in this backend.

Trying to hook Errbot on our internal Mattermost instance but it seems that every response/return of the bot is wrapped within noformat blocks (```). Believe that wrapping happens here: https://github.com/Vaelor/errbot-mattermost-backend/blob/master/mattermost.py#L446-L476

That noformat wrapping prevents the use of Markdown in bot's responses and that is one of the best features of Mattermost (and Slack ofc). Is there any workaround or special option we should enable as to have Markdown supported or is it something completely out of the question for this project?

sokratisg avatar Aug 08 '17 10:08 sokratisg

Sorry! This was me, trying to fix #8 I broke markdown in the commit. So I guess I have to revisit this message splitting again.. Have been avoiding it a bit, to be honest. This new commit should fix the markdown support - but splitting of long messages (log tail) will be broken again. But markdown is more important IMHO.

So updating the backend should do the trick :)

Vaelor avatar Aug 08 '17 11:08 Vaelor

Thank you very much!

sokratisg avatar Aug 08 '17 11:08 sokratisg

Also, MD is broken when you enable GROUPCHAT_NICK_PREFIXED = True in Errbot's config.py.

sokratisg avatar Aug 08 '17 12:08 sokratisg

Oh, Thanks. I will have a look at that!

Vaelor avatar Aug 08 '17 12:08 Vaelor

@sokratisg It works fine in my case, with GROUPCHAT_NICK_PREFIXED = True. Is the message very long, and split up in multiple parts? Any special plugin which generates the markdown?

Running !render test worked fine in a group channel.

example

Vaelor avatar Aug 08 '17 12:08 Vaelor

Try rendering a MD Table. e.g:

| test title | test title |
| :--- | :---: |
| l1c1 | l1c2 |
| l2c2 | l2c2 |

sokratisg avatar Aug 08 '17 13:08 sokratisg

Ah yes. Testing !whoami which only renders a table, is definitly broken. Modifying the output, putting two newlines in between the name/table works.

I am on it, not sure if it is an issue with the backend or mattermost because it does not render markdown if it is not on a new and empty line or who knows what :)

Vaelor avatar Aug 08 '17 13:08 Vaelor

FWIW this seems to work for me on latest. 2018-03-14-010928_775x949_scrot

dijit avatar Mar 14 '18 00:03 dijit

@dijit does !whoami also renders correctly?

(Shit has it been 7 months that I said I'm on it? Damn it, days are too short.)

Vaelor avatar Mar 14 '18 09:03 Vaelor

whoami renders correctly on mattermost v5, perhaps this issue should be closed?

image

nzlosh avatar May 20 '21 17:05 nzlosh