11

I just edited an answer of mine about a dozen times, because the result of my tables as shown in the preview, didn't match what was actually shown when posted. So I had to keep re-editing until it lined up right.

If we can't make an easier table functionality, can we at least get the preview to show exactly what will be shown as the final result?

Note: This is within a code block, and note that while there are tabs in the example shown, I've edited out all tabs, made sure it was all spaces for whitespace, and it still comes out wrong.

EDIT: In the end Tim was right, it was tabs hiding in the markdown. So the lesson is that you need all spaces, though I still consider having to work around things this way to be a bug.

Edit Preview:

enter image description here

Final Result:

enter image description here

3 Answers 3

16

I have rewritten the detabber in the client-side editor; it now actually works.

That means it behaves exactly like the server-side Markdown version, replacing tabs by one to four spaces such that the following character ends up in a column that's a multiple of four.

In other words, just like your favorite IDE does it – unless you have set it up to do it wrong. </flamebait>

1
  • That means people's tabbed code should now work - yay!
    – ChrisF Mod
    Commented May 9, 2011 at 22:54
8

There are actually are tabs in your answer. You can see them by trying to select the whitespace in between the columns in the revision source (or maybe they appear as single-space width characters to you, which would explain the problem).

Illustration of tab characters

6
  • Thanks I didn't notice that, BUT when I go back and edit all the whitespace to only spaces, it still turns out wrong (I rolled it back now to the working but tabbed view). I've edited my note to reflect this. Commented Feb 2, 2011 at 18:23
  • 1
    @LanceRoberts: Note that Tim hasn't highlighted all tabs in there (the header row is also full of them). Do you really have a version that contains no tab character at all and still looks different in preview and final? That would honestly surprise me.
    – balpha StaffMod
    Commented Feb 2, 2011 at 18:32
  • @LanceRoberts If you copied from Excel, the content is copied as tab-delimited, so everything in the table has a tab separating it from the previous field. I pulled the table from your answer's edit view and did a replace on \t, then added in spaces for formatting, and I get what badp's answer shows.
    – Tim Stone
    Commented Feb 2, 2011 at 18:34
  • @balpha, yep, you're right that fixed it. I'll vote to close. I sure hope they fix markdown someday to handle tabs right. Commented Feb 2, 2011 at 18:39
  • 3
    @LanceRoberts: well, you're not totally wrong. I'm looking at WMD's detabbing implementation, and I'm seeing at least three bugs...
    – balpha StaffMod
    Commented Feb 2, 2011 at 18:40
  • 1
    @balpha Slay those tabs! shakes fist at them
    – Tim Stone
    Commented Feb 2, 2011 at 18:43
2

Sorry, cannot reproduce your issue. :(

Month   Week    Year    Concat  Hours  Total_Hours
  1      2      2011    120211    8        12
  1      2      2011    120211    4        12
  1      2      2010    120210    7         7
  1      2      2009    120209    5         5
2
  • Do you think it's just a Chrome issue? Commented Feb 2, 2011 at 18:11
  • 1
    @Lance I'm using Chrome 11.0.652.0
    – badp
    Commented Feb 2, 2011 at 18:12

You must log in to answer this question.

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