-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Gfm tables #1245
Gfm tables #1245
Conversation
It seems there's some catastrophic backtracking in some of the regexes. For some reason, my local tests did not find these, but I can see a list in the travis-ci link. |
That is strange. No errors show up on my computer either when I run /cc @davisjam It looks like the failing tests aren't ones you changed in this PR anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome 💯 Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTML5 compliance?
@@ -944,7 +949,7 @@ Renderer.prototype.tablerow = function(content) { | |||
Renderer.prototype.tablecell = function(content, flags) { | |||
var type = flags.header ? 'th' : 'td'; | |||
var tag = flags.align | |||
? '<' + type + ' style="text-align:' + flags.align + '">' | |||
? '<' + type + ' align="' + flags.align + '">' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re:
- https://www.w3schools.com/tags/att_table_align.asp / https://www.w3schools.com/tags/att_th_align.asp / etc. ... Not HTML5 compliant according to them. Also in a few other places in this PR. Is that compliance being discarded? EDIT The change will affect our sites sanitization I believe... potentially break. This is what I have mentioned with interopability with other packages not too long ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is GFM compliant, not HTML compliant. Compliance with GFM requires that we break HTML compliance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is GFM compliant, not HTML compliant. Compliance with GFM requires that we break HTML compliance.
That's why it's in the form of a question. Good to know of a major breaking change as @styfle put it in the issue. If we continue to use this package we'll need to undo this for our sanitizer (which we do for HTML5 anyhow) as we are always striving for HTML5 compliance. Anyone using this change that has a HTML5 compliant badge will need to do this as well since it's non-standard or they'll lose their logo/rating.
Since I've been on GH just about as long as they've been around I can make an educated guess that they did this spec for older browser compatibility and also their sanitizer. So when the HTML4.x specifications drop out (presumably around 2020ish when everything hits the fan) the backward compatibility reintroduced here will not render tables correctly and it may need to be reversed. Time will tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extensions can be made based on flavor in the future?? https://rawgit.com/fletcher/human-markdown-reference/master/index.html - Multimarkdown uses the inline style solution, which is not the solution used in GFM - check out the tables example and inspect element. We are definitely focused on two or three flavors to get us there.
If this gets merged now, it would be part of the 0.4, which would indicate breaking change under the zero major. If it gets merged following 0.4 then that release would be 0.5.
@styfle, @UziTech, and @davisjam Maybe a "breaking" label?? to serve as an indicator for everyone...think @styfle adding the name of 0.4.0 to the next release was a good move.
See also #1225 and #746 (We've also talked somewhere else about not making Markdown flavors but the extension.)
Be interesting to compare this PR on Android as my GFM tables are way messed up there with Android 7/8 and latest Chrome/Firefox too. Desktops have been acceptable for years but portables really look weird. Example rendered page where a GFM table is made and generated with this issue: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For someone who says they're not sure what they're doing, you did well on this one.
Would like to get a review from @davisjam due to the failing security scan. |
Here are the explanations.
Travis is run repeatedly so it overcomes limitation 1 eventually. Travis does not have persistent storage across runs, so it has no cache and thus is not affected by limitations 2 and 3. If @tomtheisen did not introduce these regexes, the PR is fine from a security standpoint, although a separate issue should be opened to track them. This is relevant to the discussion about a safe API in #1226. |
I still stand by my solution for a versioned API to avoid this problem in the future. Then we could disable the caching. |
@davisjam In the meantime, can we merge this PR? |
If @tomtheisen did not introduce these regexes, the PR is fine from a security standpoint. I didn't check whether or not he did so. |
@UziTech
|
I see, so any regex that doesn't have a character limit or lead anchor will be subject to catastrophic backtracking? |
@UziTech Effectively I think it means that a regex |
Marked version: 0.3.19
Markdown flavor: GitHub Flavored Markdown
Description
This PR introduces full compliance with GFM tables. (I think) I'm new here, and this is a somewhat bigger code change. Despite my best efforts, I may have messed something up, so feedback is welcome.
Contributor
The gfm_tables tests cover this functionality.
Committer
In most cases, this should be a different person than the contributor.