Skip to content
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

Simple tables vs Complex tables #171

Closed
Martii opened this issue Nov 24, 2015 · 8 comments
Closed

Simple tables vs Complex tables #171

Martii opened this issue Nov 24, 2015 · 8 comments
Assignees
Labels

Comments

@Martii
Copy link

Martii commented Nov 24, 2015

This package doesn't seem to handle complex tables in GFM such as:

Mozilla Firefox Mozilla SeaMonkey Apple Safari Opera Software Opera Microsoft Internet Explorer Chromium Projects ChromiumGoogle Chrome                     
Linux Greasemonkey Greasemonkey prc uso - installWith GM_config Greasemonkey Port uso - installWith GM_config
Macintosh Greasemonkey Greasemonkey prc uso - installWith GM_config Greasemonkey Port uso - installWith GM_config
Windows Greasemonkey Greasemonkey prc uso - installWith GM_config Greasemonkey Port uso - installWith GM_config

... which renders, using markdown-it, as:

markdownitsimplevscomplexfailing

... but should be rendered, using marked, as:

markedsimplevscomplexworking

This is probably the only reason our project hasn't utilized this package with GFM table support appearing to be incomplete. (although I haven't tested out our HTML sanitizer with this since we need direct calls to the block rendering but that is the next step after this issue may be resolved)

Plain text tables appear to work but start doing non-text (e.g. complex md with tables) and it appears to fail. This project looks super since I first investigated it a few months back but this one little thing is enough not to use it in our project... I really like the modular (plugin) design though.

Is there a reason why complex tables aren't working? (with markdown-it) TIA

@puzrin
Copy link
Member

puzrin commented Nov 24, 2015

Is there a reason why complex tables aren't working?

The lack of clear specs & tests.

@Martii
Copy link
Author

Martii commented Nov 24, 2015

I can write some tests for tables but the specs are buried on GH somewhere in code most likely... I can ask support but they may or may not share that info (possibly telling me to go hunt for it)... IDK yet.

If I were to guess at this... without fully knowing this project here... I would possibly assume that a precedence issue is present on parsing and might be the issue... again IDK yet.

Thanks for the reply.

@puzrin
Copy link
Member

puzrin commented Nov 24, 2015

Could you simplify your example (reduce size to minimal possible)?

@vyp
Copy link
Contributor

vyp commented Nov 24, 2015

@Martii Do you know what GitHub uses for GFM parser?

@Martii
Copy link
Author

Martii commented Nov 24, 2015

@vyp
That's what I would need to go hunting for... GH uses codenames for each of their components (gollum for example is their wiki) and I'd have to find out what it is, go find it, then see if it's a language I know, and see if I can decipher the GFM table standards.

@puzrin
I'll see if I can simplify where it first starts to fail but the code itself is in the first post above (edit the post and you can see it)... the original HTML I posted back in the day is here but that's just the markup.

@vyp
Copy link
Contributor

vyp commented Nov 24, 2015

@Martii I looked for this before and was pointed to https://github.com/vmg/redcarpet, but then later I was told that's not what GitHub uses anymore, but I don't think I was ever told what it does use now. Hence why I asked, good luck.

@Martii
Copy link
Author

Martii commented Nov 24, 2015

@puzrin
Looks like this is what is busting tables in markdown-it:

With...

| [![Mozilla SeaMonkey][imgsm]][urlsm] |
 :-----:
| [![Greasemonkey Port][imggpsf]][urlgpsf] [![uso - installWith][imgiwi]][urliwi] [![GM_config][imggmc]][urlgmc] |

... notice that the pipes aren't matched intentionally. GH itself doesn't seem to care in my first post above... e.g. it inherits the outer pipes is a guess.

This also busts it:

| [![Mozilla SeaMonkey][imgsm]][urlsm] | something else |
| :-----: |  :-----: |  :-----: |
| [![Greasemonkey Port][imggpsf]][urlgpsf] [![uso - installWith][imgiwi]][urliwi] [![GM_config][imggmc]][urlgmc]

... where the "th" count is two and the next line down count is three... again GH doesn't seem to care:

Mozilla SeaMonkey something else
Greasemonkey Port uso - installWith GM_config

No outside pipes example on all lines but still two and three column count for line one and two (SIDENOTE: broke/fixed GH's syntax highlighter with fences here since the "Greasemonkey Port" is purplish and "broke" their table rendering too ;)

[![Mozilla SeaMonkey][imgsm]][urlsm] | something else
:-----: |  :-----: |  :-----:
[![Greasemonkey Port][imggpsf]][urlgpsf] [![uso - installWith][imgiwi]][urliwi] [![GM_config][imggmc]][urlgmc]
Mozilla SeaMonkey something else

Greasemonkey Port uso - installWith GM_config

Unbroken table on GH (line 3 has a trailing pipe now):

 [![Mozilla SeaMonkey][imgsm]][urlsm] | something else
 :-----: |  :-----: |  :-----:
 [![Greasemonkey Port][imggpsf]][urlgpsf] [![uso - installWith][imgiwi]][urliwi] [![GM_config][imggmc]][urlgmc] |
Mozilla SeaMonkey something else
Greasemonkey Port uso - installWith GM_config

So it would appear that GH is centric on line two (the dashes) for creating the th tags, with probable unused column clipping, and markdown-it needs both line one and line two to be identical column count with formatting.

@rlidwka
Copy link
Member

rlidwka commented Jan 4, 2016

Fixed, now all examples you posted above should work like they do on github.

There are still no guarantees that the output will always match 'cause there is no specification for tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants