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

Fix pre issue + update marked.js #732

Merged
merged 10 commits into from May 6, 2016
Merged

Fix pre issue + update marked.js #732

merged 10 commits into from May 6, 2016

Conversation

marcoscaceres
Copy link
Member

No description provided.

@marcoscaceres marcoscaceres force-pushed the update_marked branch 2 times, most recently from 973bece to efaf538 Compare May 3, 2016 09:59
@marcoscaceres
Copy link
Member Author

@tobie, git blame says this is mostly your baby. Hopefully I didn't break it. Would you mind having a looksy.

gfm: false,
pedantic: false,
sanitize: false
sanitize: false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ones I removed default to either true or false.

@tobie
Copy link
Member

tobie commented May 3, 2016

Your best bet is to compare https://coremob.github.io/coremob-2012/ with both scripts.

@marcoscaceres
Copy link
Member Author

@tobie, ah, super helpful... some breakage 😢
screenshot 2016-05-03 20 40 19

@halindrome
Copy link
Contributor

I am concerned about a comment you made in the spec-prod email about IDs on section elements no longer being provided. I wonder about the A11Y impact of that on screen readers and navigation. Also on other parts of ReSpec or plugins that might expect sections to have IDs. @LJWatson can you provide any insight on the A11Y front?

@marcoscaceres
Copy link
Member Author

Also on other parts of ReSpec or plugins that might expect sections to have IDs

Very few people use markdown, afaict.

@halindrome
Copy link
Contributor

I am sure you are right. I had forgotten it was supported.

@marcoscaceres
Copy link
Member Author

Found via:
https://github.com/search?l=html&p=1&q=org%3Aw3c+format+markdown&type=Code

Will check those tomorrow and see what I broke with Core Mob.

@marcoscaceres
Copy link
Member Author

hmm... seems I need to convert all HTML nodes except section into text, then parse them as markdown. should be easy to do... famous last words.

@marcoscaceres marcoscaceres force-pushed the update_marked branch 3 times, most recently from d471db2 to ea80498 Compare May 5, 2016 09:13
@marcoscaceres
Copy link
Member Author

Ok, this seems happy

@marcoscaceres
Copy link
Member Author

And it passes!!!! 💃 woot woot!

* <h3>Another subtitle</h3>
* <p>More text.</p>
* </section>
* </section>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The // to /* ... */ style change makes it super hard to figure out if the content changed or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Sorry about that.

@marcoscaceres
Copy link
Member Author

I've checked the spec list also. They all seem to parse correctly.

@marcoscaceres
Copy link
Member Author

@tobie, maybe you could give it a once over? let me know if it looks ok to merge.

define(
['core/marked'],
function (coreMarked) {
marked.setOptions({
Copy link
Member

@tobie tobie May 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there's something fishy going on here with regards to the global marked object and the module coreMarked object. My hunch is that I had reasons to do this. I'm not sure why I didn't document them, though. It could also just be a refactoring mistake that I failed to notice because I was then hitting the global marked object.

You might want to check whether coreMarked and marked now point to the same thing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check. Remember I also updated marked... so there should not be a global (coreMarked).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked. Marked no longer leaks into global scope.

@marcoscaceres
Copy link
Member Author

@tobie I only did very minor refactor of makeBuilder()...I couldn't figure it out... was super fancy impressive tho :) The rest I rewrote and chopped out a lot of code.

@tobie
Copy link
Member

tobie commented May 5, 2016

I only did very minor refactor of makeBuilder()...I couldn't figure it out... was super fancy impressive tho :) The rest I rewrote and chopped out a lot of code.

I wrote this a while back, now, so memory fails me, but iirc, the reason for this is that the rest of the pipeline expects nested sections, so you basically have to recreate the nesting from the flat H1-6 hierarchy that the markdown parser provides.

if (typeof text !== "string") {
throw TypeError("Invalid input");
}
var hasOpeningPre = testRegex(/<pre\b[^>]*>/i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually hostile to the idea of recreating your own mini HTML parser using regexes here given you're in a browser and can leverage the native one. Maybe that's the onlu sane solution, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give this some thought... I could work with a live DOM, and check if .parentElement is <pre>

@tobie
Copy link
Member

tobie commented May 5, 2016

Alright--done with the questions/comments here.

@marcoscaceres
Copy link
Member Author

Thanks @tobie! Great feedback. Will fix up!

I'm wanting to add language-based syntax highlighting next via highlight.js

Moar goodies coming soon
🍬🍦🍭🍩🍪🍡🍢🍮🍧

5 May 2016, at 8:09 PM, Tobie Langel notifications@github.com wrote:

Alright--done with the questions/comments here.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

@marcoscaceres
Copy link
Member Author

marcoscaceres commented May 6, 2016

@tobie, I rewrote it to use a HTML parser as you suggested. You were right: using regex for parsing HTML was a disgrace.

@marcoscaceres marcoscaceres merged commit 858f5b4 into develop May 6, 2016
@marcoscaceres marcoscaceres deleted the update_marked branch May 6, 2016 06:40
marcoscaceres added a commit that referenced this pull request May 6, 2016
* develop:
  v3.2.122
  Fix pre issue + update marked.js (#732)
  Chore(TravisCI): Test against Node 6
  chore(package): update karma-mocha-reporter to version 2.0.3 (#740)
  chore(package): update nightmare to version 2.4.0 (#741)
  chore(package): update karma-safari-launcher to version 1.0.0 (#739)
  chore(package): update karma-firefox-launcher to version 1.0.0 (#738)
  chore(package): update karma-opera-launcher to version 1.0.0 (#737)
  chore(package): update karma-jasmine to version 1.0.2 (#736)
  chore(package): update karma-jasmine to version 1.0.0 (#734)
  chore(package): update karma-requirejs to version 1.0.0 (#733)
  chore(package): update karma-ie-launcher to version 1.0.0 (#735)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants