Skip to main content
Asked
Modified 4 months ago
Viewed 843 times
48

I saw a wrong table layout where the poster did the following and it looked wrong:

Table x | Name | Category | | ---- | -------- | | A | High | | b | Medium | | c | Low |

Adding an extra empty line below 'Table x' seemed to solve the layout problem (as done below).

Table x

Name Category
A High
b Medium
c Low

Interestingly, the 'preview' is shown correct in both cases... Click Edit on this post to see the difference.

12
  • 2
    cross-site dupe (MSE): Markdown preview doesn't match post and Markdown table preview does not detect missing blank line before table header
    rene
    –  rene
    2021-01-10 10:33:43 +00:00
    Commented Jan 10, 2021 at 10:33
  • 3
    Markdown preview doesn't match post is about a line break after the table, this is about before the table (like the second link @rene posted)
    Luuk
    –  Luuk
    2021-01-10 10:44:34 +00:00
    Commented Jan 10, 2021 at 10:44
  • 9
    this is anoying, that the prevoew doesn't match the live view
    nbk
    –  nbk
    2021-01-10 13:53:20 +00:00
    Commented Jan 10, 2021 at 13:53
  • 22
    How is this still not fixed...
    Thom A
    –  Thom A Mod
    2021-08-31 14:13:36 +00:00
    Commented Aug 31, 2021 at 14:13
  • 5
    The bug persists. I met him today on a question from a new member.
    vernou
    –  vernou
    2021-11-12 16:51:51 +00:00
    Commented Nov 12, 2021 at 16:51
  • 2
    Yet another instance of this bug: stackoverflow.com/review/suggested-edits/30423554 (the table's formatting is broken in the post and in the edit review queue, but when editing the post, the preview shows the table correctly formatted)
    Dada
    –  Dada
    2021-11-25 09:29:39 +00:00
    Commented Nov 25, 2021 at 9:29
  • 3
    This bug survived until 2022! Happy New Year.
    Grismar
    –  Grismar
    2022-01-24 05:34:16 +00:00
    Commented Jan 24, 2022 at 5:34
  • 10
    Still there in 2023..
    Skary
    –  Skary
    2023-01-05 09:44:43 +00:00
    Commented Jan 5, 2023 at 9:44
  • 2
    As some may celebrate it surviving into 2023, there is a new cross-site dupe on CR.
    Sᴀᴍ Onᴇᴌᴀ
    –  Sᴀᴍ Onᴇᴌᴀ
    2023-01-25 19:23:02 +00:00
    Commented Jan 25, 2023 at 19:23
  • 1
    ran into this bug today, still there in 2024.
    Karan Shishoo
    –  Karan Shishoo
    2024-04-30 11:56:26 +00:00
    Commented Apr 30, 2024 at 11:56
  • same here: the problem persists - 08/07/2024.
    Mauricio Arias Olave
    –  Mauricio Arias Olave
    2024-07-08 14:30:08 +00:00
    Commented Jul 8, 2024 at 14:30
  • 1
    and still there in 2025. Confusing for newcomers since preview is OK, but live site is not.
    Martin Brown
    –  Martin Brown
    2025-01-17 09:03:02 +00:00
    Commented Jan 17 at 9:03

1 Answer 1

8

This is now fixed. I outlined some of the basic challenges and fixes in this answer. The short version is this is a byproduct of us having two different markdown engines: one on the client for live preview updates (markdown-it) and one on the server for final rendering (markdig). And the result of them having different implementations, as seen in Babelmark.

We've added a plugin to the client side implementation that should prevent md tables from rendering as tables when there is any text immediately before or after the table so that it's consistent with the server side processing.

Here's an example table you can try for yourself with leading text before the table:

Filled Row Before Table
| simple table |
| ------------ |
| goes here    |

And here's the result, wherein the client side preview will not render the table, which is consistent with how the post will be handled on the server side as well:

a picture of the markdown editor with a github flavored markdown table with a filled row above the table. In the markdown preview area, the table is not rendered, and instead all text is displayed in a single paragraph

1
  • 2
    It only took 4 years and 5 months, so it must have been a tough challenge to get this done .... 😉 Thanks for this change!
    Luuk
    –  Luuk
    2025-06-10 12:09:08 +00:00
    Commented Jun 10 at 12:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.