rveachkc / pymsteams

Format messages and post to Microsoft Teams.
https://pypi.org/project/pymsteams/
Apache License 2.0
424 stars 78 forks source link

HTML tables stopped working #141

Open talbaumel opened 1 year ago

talbaumel commented 1 year ago

Describe the bug I used to send HTML tables on my automatic msg, this feature stopped working (probably teams changed someting)

To Reproduce Just try to post this msg, the table won't appear "<h2>My table:</h2> <table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n <th>0</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2</td>\n </tr>\n <tr>\n <th>2</th>\n <td>3</td>\n </tr>\n </tbody>\n</table> 123"

Expected behavior See the table in the card

Screenshots

Additional context

talbaumel commented 1 year ago

Seems like the problem is because of the title

yeyeric commented 1 year ago

hello @talbaumel ,

we have the same problem here, table which were correctly displayed before disappeared. Even ones which were correctly viewable before. It looks like due to an update of teams since some users still using old version of teams can see content.

What do you mean by title ? There is no title in your sample of code ?

Also, we had noted 2/3 months ago that images embbed in html disappeared (although they are still publicly accessible), but didn't investigate further.

talbaumel commented 1 year ago

Anything after the header disappeared, when changing the msg from my original post to:

"*My table:* <br> <table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n <th>0</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2</td>\n </tr>\n <tr>\n <th>2</th>\n <td>3</td>\n </tr>\n </tbody>\n</table> 123"

I could see the table

giahung24 commented 1 year ago

while waiting for the fixes, here my experience. With my body_old, the table does not show.

body_old = f"""
DATE : {date}
TARGET : {t:.1%}
{output.to_html()}
"""

With my body_new, the problem is gone.

body_new = f"Date : {date}<br/>TARGET : {t:.1%}<br/>{output.to_html()}"