larstvei / ox-gfm

Github Flavored Markdown Back-End for Org Export Engine
230 stars 44 forks source link

Table Export Not Rendered When Header Cells Contain Empty Line #30

Open sshaw opened 6 years ago

sshaw commented 6 years ago

Org table:

| A | B |
|   |   |
|---+---|
| 1 | 2 |
| 3 | 4 |

Exported as:

| A | B |
|   |   |
| 1 | 2 |
| 3 | 4 |

Which GitHub cannot render.

larstvei commented 6 years ago

Hi, and thanks for reporting!

The crux of this issue is that the source language (Org) is much more expressive than the target language (GFM). This will always lead to some issues that don't really have a nice solution.

GFM tables have a stricter shape than Org tables, in that it requires a header and a dashed line directly below it. Org tables don't have this restriction.

(I think) There is no clear-cut way of solving this because there is no way to enforce that the GFM table restrictions are withheld without possibly altering the "meaning" of the table. In your example, removing the empty row would maybe be the "right thing to do," but that suggests that the empty row did not have a purpose in the first place.

Perhaps throwing an error if the table doesn't match the GFM restrictions would be an OK solution? But I don't think "forcing" the table into a similar table which GFM accepts is the best idea.

sshaw commented 6 years ago

In your example, removing the empty row would maybe be the "right thing to do," but that suggests that the empty row did not have a purpose in the first place.

The overarching purpose is to convert to GFM. It's a bit silly to prevent this from happing because GFM is not capable of capturing the purpose of an empty cell.

Perhaps throwing an error if the table doesn't match the GFM restrictions would be an OK solution?

Even iconv has the -c option.

So is transliteration. 😀