# API not accepting MarkDown Tables

**URL:** https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726
**Category:** Development
**Tags:** rest-api
**Created:** [March 15, 2019, 6:21pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726 "2019-03-15T18:21:09Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dpaulus](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@dpaulus](https://meta.discourse.org/u/dpaulus)
#### Post date: [March 15, 2019, 6:21pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/1 "2019-03-15T18:21:09Z")

</div>

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:_  
|Col1|Col2|  
|—|—|  
|Col1data|Col2data|  
_Image of the result:_

 ![image](https://global.discourse-cdn.com/meta/original/3X/3/a/3ac5fd199b881670d2b5d57ae46126603de4c08d.png)

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…  
|Col1|Col2|  
|\_\_\_|—|  
|Col1data|Col2data|

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](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?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 15, 2019, 6:23pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/2 "2019-03-15T18:23:28Z")

</div>

Try disabling the setting `enable markdown typographer`

---

<div class="post-metadata">

### Author: ![dpaulus](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@dpaulus](https://meta.discourse.org/u/dpaulus)
#### Post date: [March 15, 2019, 6:38pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/3 "2019-03-15T18:38:23Z")

</div>

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?

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/8/98b805a2787cc23d7bfec212ce25ecff01b43872.png)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 15, 2019, 6:40pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/4 "2019-03-15T18:40:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dpaulus](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@dpaulus](https://meta.discourse.org/u/dpaulus)
#### Post date: [March 15, 2019, 7:02pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/5 "2019-03-15T19:02:44Z")

</div>

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")
$DiscourseBodyJSON.Add("raw",$HTMLTableAll)
$DiscourseBodyJSON.Add("category",$TFOCategoryID)
$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
            }

```

Result:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/d/e/de56113cf0876728fc1b98229c283fdc51168893.png)

---

<div class="post-metadata">

### Author: ![dpaulus](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@dpaulus](https://meta.discourse.org/u/dpaulus)
#### Post date: [March 15, 2019, 7:22pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/6 "2019-03-15T19:22:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 15, 2019, 7:23pm UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/7 "2019-03-15T19:23:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 4, 2022, 9:32am UTC](https://meta.discourse.org/t/api-not-accepting-markdown-tables/111726/9 "2022-05-04T09:32:10Z")

</div>


