{"action":"created","comment":{"url":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/comments/56082474","id":56082474,"diff_hunk":"@@ -0,0 +1,74 @@\n+/*\n+ * Set up window for Node.js\n+ */\n+\n+var _window = (typeof window !== 'undefined' ? window : this);\n+\n+/*\n+ * Parsing HTML strings\n+ */\n+\n+function canParseHtmlNatively() {\n+  var Parser = _window.DOMParser\n+  var canParse = false;\n+\n+  // Adapted from https://gist.github.com/1129031\n+  // Firefox/Opera/IE throw errors on unsupported types\n+  try {\n+    // WebKit returns null on unsupported types\n+    if (new Parser().parseFromString('', 'text/html')) {\n+      canParse = true;\n+    }\n+  } catch (e) {}\n+\n+  return canParse;\n+}\n+\n+function createHtmlParser() {\n+  var Parser = function () {};\n+  \n+  // For Node.js environments\n+  if (typeof document === 'undefined') {\n+    var jsdom = require('jsdom');\n+    Parser.prototype.parseFromString = function (string) {\n+      return jsdom.jsdom(string, {\n+        features: {\n+          FetchExternalResources: [],\n+          ProcessExternalResources: false\n+        }\n+      });\n+    };\n+  } else {\n+    Parser.prototype.parseFromString = function (string) {\n+      var doc;\n+\n+      if (!shouldUseActiveX()) {","path":"lib/html-parser.js","position":45,"original_position":45,"commit_id":"b9b05ec5f7eff4601639a8d57d3d6155dbe08708","original_commit_id":"b9b05ec5f7eff4601639a8d57d3d6155dbe08708","user":{"login":"Sebmaster","id":347870,"avatar_url":"https://avatars.githubusercontent.com/u/347870?v=3","gravatar_id":"","url":"https://api.github.com/users/Sebmaster","html_url":"https://github.com/Sebmaster","followers_url":"https://api.github.com/users/Sebmaster/followers","following_url":"https://api.github.com/users/Sebmaster/following{/other_user}","gists_url":"https://api.github.com/users/Sebmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/Sebmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sebmaster/subscriptions","organizations_url":"https://api.github.com/users/Sebmaster/orgs","repos_url":"https://api.github.com/users/Sebmaster/repos","events_url":"https://api.github.com/users/Sebmaster/events{/privacy}","received_events_url":"https://api.github.com/users/Sebmaster/received_events","type":"User","site_admin":false},"body":"This is a bit less efficient since it impacts runtime performance.","created_at":"2016-03-14T21:50:08Z","updated_at":"2016-03-14T21:50:08Z","html_url":"https://github.com/Sebmaster/to-markdown/pull/1#discussion_r56082474","pull_request_url":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/comments/56082474"},"html":{"href":"https://github.com/Sebmaster/to-markdown/pull/1#discussion_r56082474"},"pull_request":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1","id":62821544,"html_url":"https://github.com/Sebmaster/to-markdown/pull/1","diff_url":"https://github.com/Sebmaster/to-markdown/pull/1.diff","patch_url":"https://github.com/Sebmaster/to-markdown/pull/1.patch","issue_url":"https://api.github.com/repos/Sebmaster/to-markdown/issues/1","number":1,"state":"open","locked":false,"title":"Move HTML parsing to own file","user":{"login":"domchristie","id":111734,"avatar_url":"https://avatars.githubusercontent.com/u/111734?v=3","gravatar_id":"","url":"https://api.github.com/users/domchristie","html_url":"https://github.com/domchristie","followers_url":"https://api.github.com/users/domchristie/followers","following_url":"https://api.github.com/users/domchristie/following{/other_user}","gists_url":"https://api.github.com/users/domchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/domchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domchristie/subscriptions","organizations_url":"https://api.github.com/users/domchristie/orgs","repos_url":"https://api.github.com/users/domchristie/repos","events_url":"https://api.github.com/users/domchristie/events{/privacy}","received_events_url":"https://api.github.com/users/domchristie/received_events","type":"User","site_admin":false},"body":"This PR moves the HTML parser code, including your fixes for malformed docs and IE9, into its own file to tidy it up a bit.\r\n\r\nHopefully this should come through to https://github.com/domchristie/to-markdown/pull/129 once merged.","created_at":"2016-03-14T21:36:42Z","updated_at":"2016-03-14T21:50:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"20b0ec0958c46331300d8a626314b2d4e961e598","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sebmaster/to-markdown/issues/1/comments","statuses_url":"https://api.github.com/repos/Sebmaster/to-markdown/statuses/b9b05ec5f7eff4601639a8d57d3d6155dbe08708","head":{"label":"domchristie:Sebmaster-fix/malformed-doc-formatting","ref":"Sebmaster-fix/malformed-doc-formatting","sha":"b9b05ec5f7eff4601639a8d57d3d6155dbe08708","user":{"login":"domchristie","id":111734,"avatar_url":"https://avatars.githubusercontent.com/u/111734?v=3","gravatar_id":"","url":"https://api.github.com/users/domchristie","html_url":"https://github.com/domchristie","followers_url":"https://api.github.com/users/domchristie/followers","following_url":"https://api.github.com/users/domchristie/following{/other_user}","gists_url":"https://api.github.com/users/domchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/domchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domchristie/subscriptions","organizations_url":"https://api.github.com/users/domchristie/orgs","repos_url":"https://api.github.com/users/domchristie/repos","events_url":"https://api.github.com/users/domchristie/events{/privacy}","received_events_url":"https://api.github.com/users/domchristie/received_events","type":"User","site_admin":false},"repo":{"id":2630230,"name":"to-markdown","full_name":"domchristie/to-markdown","owner":{"login":"domchristie","id":111734,"avatar_url":"https://avatars.githubusercontent.com/u/111734?v=3","gravatar_id":"","url":"https://api.github.com/users/domchristie","html_url":"https://github.com/domchristie","followers_url":"https://api.github.com/users/domchristie/followers","following_url":"https://api.github.com/users/domchristie/following{/other_user}","gists_url":"https://api.github.com/users/domchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/domchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domchristie/subscriptions","organizations_url":"https://api.github.com/users/domchristie/orgs","repos_url":"https://api.github.com/users/domchristie/repos","events_url":"https://api.github.com/users/domchristie/events{/privacy}","received_events_url":"https://api.github.com/users/domchristie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/domchristie/to-markdown","description":"An HTML to Markdown converter written in JavaScript","fork":false,"url":"https://api.github.com/repos/domchristie/to-markdown","forks_url":"https://api.github.com/repos/domchristie/to-markdown/forks","keys_url":"https://api.github.com/repos/domchristie/to-markdown/keys{/key_id}","collaborators_url":"https://api.github.com/repos/domchristie/to-markdown/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/domchristie/to-markdown/teams","hooks_url":"https://api.github.com/repos/domchristie/to-markdown/hooks","issue_events_url":"https://api.github.com/repos/domchristie/to-markdown/issues/events{/number}","events_url":"https://api.github.com/repos/domchristie/to-markdown/events","assignees_url":"https://api.github.com/repos/domchristie/to-markdown/assignees{/user}","branches_url":"https://api.github.com/repos/domchristie/to-markdown/branches{/branch}","tags_url":"https://api.github.com/repos/domchristie/to-markdown/tags","blobs_url":"https://api.github.com/repos/domchristie/to-markdown/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/domchristie/to-markdown/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/domchristie/to-markdown/git/refs{/sha}","trees_url":"https://api.github.com/repos/domchristie/to-markdown/git/trees{/sha}","statuses_url":"https://api.github.com/repos/domchristie/to-markdown/statuses/{sha}","languages_url":"https://api.github.com/repos/domchristie/to-markdown/languages","stargazers_url":"https://api.github.com/repos/domchristie/to-markdown/stargazers","contributors_url":"https://api.github.com/repos/domchristie/to-markdown/contributors","subscribers_url":"https://api.github.com/repos/domchristie/to-markdown/subscribers","subscription_url":"https://api.github.com/repos/domchristie/to-markdown/subscription","commits_url":"https://api.github.com/repos/domchristie/to-markdown/commits{/sha}","git_commits_url":"https://api.github.com/repos/domchristie/to-markdown/git/commits{/sha}","comments_url":"https://api.github.com/repos/domchristie/to-markdown/comments{/number}","issue_comment_url":"https://api.github.com/repos/domchristie/to-markdown/issues/comments{/number}","contents_url":"https://api.github.com/repos/domchristie/to-markdown/contents/{+path}","compare_url":"https://api.github.com/repos/domchristie/to-markdown/compare/{base}...{head}","merges_url":"https://api.github.com/repos/domchristie/to-markdown/merges","archive_url":"https://api.github.com/repos/domchristie/to-markdown/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/domchristie/to-markdown/downloads","issues_url":"https://api.github.com/repos/domchristie/to-markdown/issues{/number}","pulls_url":"https://api.github.com/repos/domchristie/to-markdown/pulls{/number}","milestones_url":"https://api.github.com/repos/domchristie/to-markdown/milestones{/number}","notifications_url":"https://api.github.com/repos/domchristie/to-markdown/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/domchristie/to-markdown/labels{/name}","releases_url":"https://api.github.com/repos/domchristie/to-markdown/releases{/id}","deployments_url":"https://api.github.com/repos/domchristie/to-markdown/deployments","created_at":"2011-10-23T10:35:39Z","updated_at":"2016-03-14T20:36:56Z","pushed_at":"2016-03-14T21:38:05Z","git_url":"git://github.com/domchristie/to-markdown.git","ssh_url":"git@github.com:domchristie/to-markdown.git","clone_url":"https://github.com/domchristie/to-markdown.git","svn_url":"https://github.com/domchristie/to-markdown","homepage":"http://domchristie.github.io/to-markdown","size":1292,"stargazers_count":1594,"watchers_count":1594,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":263,"mirror_url":null,"open_issues_count":27,"forks":263,"open_issues":27,"watchers":1594,"default_branch":"master"}},"base":{"label":"Sebmaster:fix/malformed-doc","ref":"fix/malformed-doc","sha":"3d330e175576eff9b42e33c7335283bdb3553e2a","user":{"login":"Sebmaster","id":347870,"avatar_url":"https://avatars.githubusercontent.com/u/347870?v=3","gravatar_id":"","url":"https://api.github.com/users/Sebmaster","html_url":"https://github.com/Sebmaster","followers_url":"https://api.github.com/users/Sebmaster/followers","following_url":"https://api.github.com/users/Sebmaster/following{/other_user}","gists_url":"https://api.github.com/users/Sebmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/Sebmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sebmaster/subscriptions","organizations_url":"https://api.github.com/users/Sebmaster/orgs","repos_url":"https://api.github.com/users/Sebmaster/repos","events_url":"https://api.github.com/users/Sebmaster/events{/privacy}","received_events_url":"https://api.github.com/users/Sebmaster/received_events","type":"User","site_admin":false},"repo":{"id":40978537,"name":"to-markdown","full_name":"Sebmaster/to-markdown","owner":{"login":"Sebmaster","id":347870,"avatar_url":"https://avatars.githubusercontent.com/u/347870?v=3","gravatar_id":"","url":"https://api.github.com/users/Sebmaster","html_url":"https://github.com/Sebmaster","followers_url":"https://api.github.com/users/Sebmaster/followers","following_url":"https://api.github.com/users/Sebmaster/following{/other_user}","gists_url":"https://api.github.com/users/Sebmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/Sebmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sebmaster/subscriptions","organizations_url":"https://api.github.com/users/Sebmaster/orgs","repos_url":"https://api.github.com/users/Sebmaster/repos","events_url":"https://api.github.com/users/Sebmaster/events{/privacy}","received_events_url":"https://api.github.com/users/Sebmaster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sebmaster/to-markdown","description":"An HTML to Markdown converter written in JavaScript","fork":true,"url":"https://api.github.com/repos/Sebmaster/to-markdown","forks_url":"https://api.github.com/repos/Sebmaster/to-markdown/forks","keys_url":"https://api.github.com/repos/Sebmaster/to-markdown/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sebmaster/to-markdown/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sebmaster/to-markdown/teams","hooks_url":"https://api.github.com/repos/Sebmaster/to-markdown/hooks","issue_events_url":"https://api.github.com/repos/Sebmaster/to-markdown/issues/events{/number}","events_url":"https://api.github.com/repos/Sebmaster/to-markdown/events","assignees_url":"https://api.github.com/repos/Sebmaster/to-markdown/assignees{/user}","branches_url":"https://api.github.com/repos/Sebmaster/to-markdown/branches{/branch}","tags_url":"https://api.github.com/repos/Sebmaster/to-markdown/tags","blobs_url":"https://api.github.com/repos/Sebmaster/to-markdown/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sebmaster/to-markdown/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sebmaster/to-markdown/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sebmaster/to-markdown/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sebmaster/to-markdown/statuses/{sha}","languages_url":"https://api.github.com/repos/Sebmaster/to-markdown/languages","stargazers_url":"https://api.github.com/repos/Sebmaster/to-markdown/stargazers","contributors_url":"https://api.github.com/repos/Sebmaster/to-markdown/contributors","subscribers_url":"https://api.github.com/repos/Sebmaster/to-markdown/subscribers","subscription_url":"https://api.github.com/repos/Sebmaster/to-markdown/subscription","commits_url":"https://api.github.com/repos/Sebmaster/to-markdown/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sebmaster/to-markdown/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sebmaster/to-markdown/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sebmaster/to-markdown/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sebmaster/to-markdown/contents/{+path}","compare_url":"https://api.github.com/repos/Sebmaster/to-markdown/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sebmaster/to-markdown/merges","archive_url":"https://api.github.com/repos/Sebmaster/to-markdown/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sebmaster/to-markdown/downloads","issues_url":"https://api.github.com/repos/Sebmaster/to-markdown/issues{/number}","pulls_url":"https://api.github.com/repos/Sebmaster/to-markdown/pulls{/number}","milestones_url":"https://api.github.com/repos/Sebmaster/to-markdown/milestones{/number}","notifications_url":"https://api.github.com/repos/Sebmaster/to-markdown/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sebmaster/to-markdown/labels{/name}","releases_url":"https://api.github.com/repos/Sebmaster/to-markdown/releases{/id}","deployments_url":"https://api.github.com/repos/Sebmaster/to-markdown/deployments","created_at":"2015-08-18T15:01:03Z","updated_at":"2015-08-18T15:01:03Z","pushed_at":"2016-03-14T21:38:06Z","git_url":"git://github.com/Sebmaster/to-markdown.git","ssh_url":"git@github.com:Sebmaster/to-markdown.git","clone_url":"https://github.com/Sebmaster/to-markdown.git","svn_url":"https://github.com/Sebmaster/to-markdown","homepage":"http://domchristie.github.io/to-markdown","size":1005,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1"},"html":{"href":"https://github.com/Sebmaster/to-markdown/pull/1"},"issue":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/issues/1"},"comments":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Sebmaster/to-markdown/statuses/b9b05ec5f7eff4601639a8d57d3d6155dbe08708"}}}}