API não está aceitando tabelas MarkDown

Utilizamos a solução hospedada.

Descrição do Problema: Usar a API para fazer publicações. Isso funcionou perfeitamente nos últimos 4 meses (o último sendo segunda-feira, 11/03/2019) até hoje. Criei alguns testes muito simples para isolar o problema:

Dados enviados via API:

Col1 Col2
Col1data Col2data

Imagem do resultado:

Observe o separador de cabeçalho/dados destacado no início. De alguma forma, ele foi alterado de três traços para uma linha completa. O segundo separador não foi alterado. Acredito que este seja o problema. Como o separador da primeira coluna não é mais três traços, ele não o interpreta mais como uma tabela em markdown. Simplesmente não sei o que faz os três traços se transformarem nesses caracteres de linha.

Posso (mais ou menos) replicar essa “mudança de traços para linha” ao postar manualmente também. Se eu inserir isso (note que o separador da segunda coluna são três traços)… bem, é isso até ser postado…
|Col1|Col2|
|___|—|
|Col1data|Col2data|

A publicação realmente mostrará o segundo separador agora como uma linha completa. Como sou um novo usuário neste site, ele está dizendo que não posso postar mais de duas imagens (hein?), então não consigo mostrar a imagem exata, mas aqui está uma URL de teste: https://try.discourse.org/t/test-table-cause-seeing-problem/1335

Acredito que o que estiver causando essa mudança dos traços para o caractere de linha também seja o que está afetando a mudança dos três traços na API. Mas isso é apenas um palpite.

Alguém poderia, por favor, ajudar a esclarecer isso? 1) Por que isso está acontecendo? 2) Algo mudou recentemente que poderia ter causado isso?

Try disabling the setting enable markdown typographer

1 curtida

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

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")
$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:

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.

4 curtidas