What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

This question already has an answer here:

In What HTML tags are allowed on Stack Exchange sites?, Jeff explains which basic HTML elements are allowed. Near the end he states

We do not and will not allow table tags -- sorry. This is intentional and by design.

I am wondering what the rationale behind the decision is. I could see the difficulty in getting the tr and td elements to properly close for users not familiar with HTML, and perhaps how tables lend themselves to wasting too much horizontal real estate.

I'm not suggesting that tables be allowed in the SO engine, but I would like to know what pitfalls I can expect if I allow my users to enter them in my (soon-to-be-written) application that allows markup.

share|improve this question

marked as duplicate by doppelgreener, apaul34208, mhlester, Azik, РСТȢѸФХѾЦЧШЩЪЫЬѢѤЮѦѪѨѬѠѺѮѰѲѴ Jun 2 at 6:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Voting to close as a dupe because the other question has an answer from a developer as to why Stack Exchange hasn't done it (including the pitfalls being asked about here), and this question has no authoritative answer. –  doppelgreener Jun 2 at 1:48

4 Answers 4

I'm not suggesting that tables be allowed in the SO engine, but I would like to know what pitfalls I can expect if I allow my users to enter them in my (soon-to-be-written) application that allows markup.

If you allow users to enter html markup and you whitelist table elements without providing a proper pattern requirement, it's possible to affect any page's rendering which uses tables as a major layout component in most browsers, sometimes in some very interesting (and/or destructive) ways. Allowing users to generate tables through alternate means is often safer (non html markup run through an engine to create the actual table), if the associated logic pattern for the actual table generation is tight and can't break.

The gist of it is that you can break out of either cells or entire tables within a post (by using unbalanced closing tags), making the content you follow your break out with appear in odd places. This can happen even unintentionally with a malformed table. (unbalanced opening tags can have consequences involving table elements following the content)

I've actually seen this happen before on a major forum (arstechnica.com, back when html was more widely permissible). Unfortunately that was over ten years ago, so I can't link the thread (it involved someone trying to make a table for decibel levels leading up to eardrum rupture, which was fairly amusing when it ruptured the page).

If you're using divs for all of your layout you're probably fine. If you had strong whitelist pattern requirements for using table elements you would hopefully also be fine.

share|improve this answer

My guess is because Jeff & Co don't want to deal with the hassles that user-generated tables bring.

However, you can pseudocode tables by using the <pre> or code markup, since spaces are respected:

like   this   table
right  here   .

Malformed table HTML can screw up the site layout pretty royally. And that makes nobody happy.

share|improve this answer
7  
I'm pretty sure you cannot create a malformed table with Markup :) –  Jonathan Sampson Aug 21 '09 at 19:30
14  
I'll create a malformed you with markup. –  Eric Aug 21 '09 at 19:37
2  
@Eric - funniest thing I've ever read on MSO. –  user208778 Jan 21 '13 at 10:19
1  
@Eric - I can't stop smiling reading this comment... –  encryptoferia Apr 5 '13 at 6:25

Markdown doesn't actually have a markup syntax for tables. There are some add-ons that do, such as PHP Markdown Extra, but neither WMD nor whatever SO uses server-side supports them.

Jeff seems to be of the opinion that tabular data can be represented well enough using code sections so as to accomplish most tasks. I would imagine the extra expense of supporting and validating tables does not seem particularly worthwhile to the team.

share|improve this answer
3  
Well, Markdown also doesn't actively disable the html table tags. Tables in markdown are just tables in HTML. –  badp Jun 23 '11 at 14:35
1  
@badp: In the Stack Exchange network, the HTML <table> (and related) elements are actively stripped. –  w3d Aug 4 '12 at 12:24
2  
@w3d Yes, but that is part of the html sanitization by Stack Exchange, not the markdown specification itself. –  badp Aug 6 '12 at 14:44
1  
@badp: Sorry, in my haste, I thought you were implying that you could fall back to using HTML table tags on SO. –  w3d Aug 6 '12 at 16:37

I imagine the reason is because Jeff & Co. don't want to have to worry about people using undesired markup elements which could potentially blow apart the site's layout.

It is probably easier just to say "no tables" then to have to make sure that tables don't screw things up.

share|improve this answer
7  
Sloths! –  XMLbog Aug 21 '09 at 19:30
27  
You can't create a broken table with Markup. If the correct patterns aren't found, it doesn't create a table. –  Jonathan Sampson Aug 21 '09 at 19:33
1  
put the table inside some block element like IFRAME with strictly set bounds - and it would not blow nothing but itself –  Arioch 'The Jan 16 '13 at 11:46

Not the answer you're looking for? Browse other questions tagged .