gpoore / codebraid

Live code in Pandoc Markdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markdown tables rendered incorrectly

sergei-mironov opened this issue · comments

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

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

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

-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.