Back in the days GitHub Wiki supported embedding HTML tables, but now all our tables are not rendered anymore. Is support for HTML tables officially dropped (can't find corresponding news or blog post)?
-
HTML tables should work just fine. When did this change take place? Can you share the code that no longer seems to be working? A minimal reproducible example would be very helpful here.Chris– Chris2017-08-13 18:46:57 +00:00Commented Aug 13, 2017 at 18:46
-
We have this page here: github.com/moxiecode/plupload/wiki/Required-Features. Notice HTML, it used to be fully rendered table.jayarjo– jayarjo2017-08-15 05:17:14 +00:00Commented Aug 15, 2017 at 5:17
-
Looks like one extra newline was breaking the whole thing, fixed now.jayarjo– jayarjo2017-08-15 05:26:26 +00:00Commented Aug 15, 2017 at 5:26
3 Answers
GitHub does support table tag but it's not as extensible as in any HTML file. It's pretty much limited to what one may need for a wiki. In my view, it's pointless to use <table> because they are tiring compared to other markdowns that GitHub wiki use.
Markdown -
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
Preview -
Equivalent HTML -
<table>
<tr><th>First Header</th><th>Second Header</th></tr>
<tr><td>Content Cell</td><td>Content Cell</td></tr>
<tr><td>Content Cell</td><td>Content Cell</td></tr>
</table>
1 Comment
2017:
Back in the days GitHub Wiki supported embedding HTML tables, but now all our tables are not rendered anymore.
2022: they should be rendered now:
Updates to Markdown pasting on GitHub
May 19, 2022
We've made some updates to how paste formatting works in Markdown-enabled fields on GitHub.
For example, in code editors and on gists, you'll now be able to paste URLs on selected texts that will render as Markdown links like
[...](https://...)by using the keyboard shortcut cmd|ctl + v..The following paste formatting changes have been made to pull requests, issue comments and wikis:
Spreadsheet cells and HTML tables will render as Markdown tables
Any copied text containing links will render the links in Markdown.
All of this formatting can be disabled when pasting using the keyboard shortcut: cmd|ctl + shift + v or cmd|ctl + shift + Alt + v.
Comments
According to GitHub's Markdown spec, the Markdown parser permits most any raw HTML. The important thing is that the tags must begin at the start of the line. There are also rules which change the behavior when the raw block contains blank lines in some situations. Prior to adopting the current spec, I'm not sure if they were as strict about that, but that could be a reason for the change (some example input would help narrow down the possibilities).
And as another answer suggests, the GitHub Flavored Markdown spec includes a tables extension, so you can create tables natively in Markdown. This eliminates the need to structure your own HTML to the whims of the Markdown parser.
However, that is only the beginning of GitHub's processing of your input. After passing your input through the Markdown parser, there are four additional steps of processing taken on the output generated by Markdown as documented in the github/markup project. The most likely culprit is step two, which sanitizes the HTML. If your raw HTML doesn't match the expectations of the very narrow sanitizer, then it will get stripped out. The specifics of the santitizer are not documented, but the code is available to review and pretty easy to follow (even for those of use who aren't very familiar with Ruby).
Interestingly, the Markdown parser is sure to output HTML that the santitizer allows through, and in fact, tables are allowed. However, if you are using raw HTML rather than Markdown tables for more flexibility, then it is likely the extras that Markdown doesn't give you are causing the sanitizer to eat your tables (for example, you only get limited attributes, and improperly nests tags are stripped). In other words, raw HTML tables can only be limited to the basic features you already get with Markdown tables. Given the simplicity of Markdown tables over raw HTML, most people just use the markdown tables. YMMV.

