API not accepting MarkDown Tables

We use the hosted solution.

Description of Problem: Use the API to make posts. This has worked perfectly for the last 4 months (the last being Monday 3/11/19) until today. I created a couple very simple test to narrow down the problem:

Data being sent thru API:
Image of the result:

Notice the highlighted first header/data separator. Somehow it was changed from 3 dashes to a full line. The second separator was not changed. I believe this is the problem. Because the first column separator is not 3 dashes anymore, it doesn’t interpret it as a markdown table anymore. I just don’t know what causes the 3 dashes to change to this line char(s).

I can (sort of) replicate this ‘changing of dashes to a line’ when posting manually as well. If I enter this (note the second column separator is 3 dashes)…well, it is until it posts…

The post will actually show the second separator now as a full line. Since, I’m a new user to this site, it’s saying I can’t post more than two images (huh?), so I can’t show the exact image, but here is a test url: https://try.discourse.org/t/test-table-cause-seeing-problem/1335

I believe whatever is causing that change of the dashes to the line character, is also what is affecting the 3 dashes to change in the API as well. But, this is all a guess.

Can someone please help shed any light on this? 1) Why is this happening? 2) Did something change recently that could have caused this?

Try disabling the setting enable markdown typographer

1 Like

Thanks for the quick reply Rafael. That definitely got back the 3 dashes, but it still displays as plain text, instead of converting it to a table, like I would expect. So, quite possibly, what I thought was the issue was not :-(. Any other suggestions as to why this may not be displaying correctly as a table after posting thru the API?


Can you share the exact content of the post sent to the API here?

Not really - it’s a a PS script…the first line tho shows the data being passed in, and the result shown above…

 $HTMLTableAll = '|Col1|Col2|<br>|---|---|<br>|Col1data|Col2data|'

#Create Discourse JSON Body for posting new Topic
$DiscourseBodyJSON = @{}
$DiscourseBodyJSON.Add("title","Test - please ignore")
$DiscourseDevNoteJSON = $DiscourseBodyJSON | ConvertTo-Json
$URI = $TWDomain + "posts.json" + $DiscourseCredsURI

Show-Log -LogType Txt -LogText $URI
Show-Log -LogType Txt -LogText $HTMLTableAll

$PostNote = @{Method     = 'POST'
             Uri         = $URI  
             ContentType = "application/json"
             Headers     = @{Authorization = "Basic " + [System.Convert]::ToBase64String($DiscourseUserEnc)}
             Body        = $DiscourseDevNoteJSON


Actually, I have this working again. I think that settings change actually did fix this issue. Thanks for the help!

Only thing that jumps to me is that we use \n for line breaks in the API instead of <br>.

Anyway, since it’s working already, keep going.