-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Markdown] Decide what to do with tables #4325
Comments
To me option 1 is a no brainer - use GFM table syntax where possible, HTML otherwise, and hope that in future more of the HTML tables can be auto-generated. But even within GFM there is some variant that we should lock down. E.g.
|
+1
Can you show me an example of the first format? The GFM spec only talks about the second AFAICS.
Do you mean "vertical header"? I wouldn't, no, because it's not semantic HTML. |
This is going to give you/us some headaches long term. Because I can almost guarantee that people will use this kind of approach to do tables once we support markdown ("if you build this we will come"). This is the minimal syntax (you can also use colons on the second line to control column alignment)
This is the fullest syntax
I should note that in the full syntax you don't need to have the precise alignments of columns etc, but if you don't then it is a bit irritating to look at. The problem with the minimal format is some renderers do not recognise first-column cell with empty space (you have to insert a non-breaking space HTML char. Yes, I meant vertical header sorry. |
I wanted to endorse the "use GFM syntax when we can, and HTML tables the rest of the time" option. 👍 For the table source appearance problem, the ideal thing would be to use Prettier (or similar) to automatically format and enforce the full syntax. Whether we can do that in practice depends on us not adopting any Prettier-unfriendly changes to CommonMark/GFM (e.g., adopting kramdown-style block attributes would preclude this option). For the horizontal header problem, I think that's on PR reviewers to block, right? We can already do blasphemous things in HTML, but it's my hope that someone reviewing my PR would tell me to cut it out. 😄 |
That's interesting, I was talking about using Prettier with @Gregoor today. I agree that being able to use it would be a big advantage.
Yes. |
My vote is for option 1. |
Sounds like we're all in agreement. Worth updating the spec and closing this? |
Yeah, I'm working on it, this will be the next one to close. |
I've updated #3350 (comment) with some guidance for the converter about converting tables, so I'm going to close this one. |
GitHub-Flavored Markdown supports a table syntax: https://github.github.com/gfm/#tables-extension- , but it's quite limited.
As far as I can tell, the table:
This means a lot of our tables won't be representable using this syntax.
I can think of three main options here:
I'm not keen on (3), because I think we should stay with GFM as much as we can and not invent or import extra syntaxes unless we really have to. I think I like (1) best, but it depends a bit on how many tables we have and what they are like.
So I did a bit of digging into our use of tables in the JS docs.
Given @Elchi3 's work over in mdn/yari#3518, it looks like we'll be able to generate spec tables from data quite soon (just as we already do for compat tables. So probably we would only have to worry about the 98 tables that aren't spec tables.
I did a bit more digging into this: https://docs.google.com/spreadsheets/d/1PGty8FHBPaShQdnO8mWBFAcEeddCpOXuoTkUhezAY80/edit#gid=0 .
In summary, of 98 (non spec table) tables in the JS docs:
If we think it's OK to stop using captions we can in theory represent about 2/3 of the tables using GFM syntax. Our own docs recommend using captions for tables: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table#captions meaning this might be a stretch (but we don't as a rule use captions at the moment anyway, so...).
The third that are using column headings or block elements would have to use raw HTML.
As an aside, pages that use complex tables are pleasingly rare, and where the occur, the page would be made much better by simplifying them. See for example #4133.
The text was updated successfully, but these errors were encountered: