reverse_markdown icon indicating copy to clipboard operation
reverse_markdown copied to clipboard

Github tables without a header row

Open vanboom opened this issue 4 years ago • 3 comments

I have some tables that are coded in HTML without

like this...
<table>
<tr>
<td><b> header 1 </b></td> <td> <b> header 2 </b> </td>
<td> item 3 </td> <td> item 4 </td>
</tr>
</table>
| header 1 | header 2 |
| item 3 | item 4 |

Suggestion: github_flavored should treat the first row as the header row to match the Github markdown spec for tables. The markdown shown above is not being converted back to HTML properly by Redcarpet or the github_markup gem (Ruby). Thanks!

vanboom avatar May 23 '20 19:05 vanboom

Hi @vanboom,

The github markdown specs looks no different to the regular one concerning tables: https://guides.github.com/features/mastering-markdown/

Maybe I don't get the point yet, but I'd rather not treat td with b tags any special unless it's a real thing in any spec.

xijo avatar May 26 '20 13:05 xijo

Yes, I agree that the td + b approach would not be the best option. The issue is that I have a table that does not have a

in the header so the markdown is appearling like this:
| header 1 | header 2 |
| item 3 | item 4 |

Without the | ---- | ---- | line to denote the header row, the Github markdown translator is not treating the table as a table when attempting to render the markdown back to HTML. I am using the github-markdown gem to convert the markdown to HTML.

vanboom avatar May 30 '20 16:05 vanboom

I was able to get a possible solution working on my fork which detects and treats the first row of the table as the header row regardless of the presence of

. I will try to get a PR together for your consideration.

vanboom avatar May 30 '20 16:05 vanboom