gpoore / codebraid

Live code in Pandoc Markdown
BSD 3-Clause "New" or "Revised" License
367 stars 13 forks source link

Markdown tables rendered incorrectly #25

Closed sergei-mironov closed 4 years ago

sergei-mironov commented 4 years ago

The following code

```{.python .cb.run}
print('''
|   Name    |  SST-2  |  MRPC  |
|-----------|---------|--------|
| accuracy  |  0.868  | 0.757  |
| buildtime | 781.831 | 50.946 |
''')

produces correct output documents of html format (`<table>...</table>`) but for markdown documents the result is

Name SST-2 MRPC


accuracy 0.868 0.757 buildtime 781.831 50.946


i.e. 1) Strange double-space at the start of every line and 2) no `|` characters mark table borders. As a result, Github doesn't parse such text as tables. Please, consider checking!

I run codebraid with teh following command:

codebraid pandoc \ -f markdown -t markdown --no-cache --overwrite --standalone \ --self-contained -o out.md inp.md.in

sergei-mironov commented 4 years ago

I think this could be a pandoc-related problem. I'm using pandoc-2.7

sergei-mironov commented 4 years ago

Ok, this turned out to be a pandoc thing. The solution is to add -t gfm to the list of pandoc arguments.

gpoore commented 4 years ago

-t gfm is what you want in this case. Recent versions of Pandoc have apparently introduced an incompatibility in markdown-to-markdown conversion, though, so I will create a new, separate issue for that.