{"action":"created","comment":{"url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/comments/62537869","id":62537869,"diff_hunk":"@@ -181,6 +198,129 @@\n     return text;\n   };\n \n+  /*\n+   * Copied from Highlight.js Private API\n+   * Will be removed when this part of the API is exposed\n+   */\n+\n+  /* Utility functions */\n+\n+  function escape(value) {\n+    return value.replace(/&/gm, '&amp;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;');\n+  }\n+\n+  function tag(node) {\n+    return node.nodeName.toLowerCase();\n+  }\n+\n+  /* Stream merging */\n+\n+  function nodeStream(node) {\n+    var result = [];\n+    (function _nodeStream(node, offset) {\n+      for (var child = node.firstChild; child; child = child.nextSibling) {\n+        if (child.nodeType == 3)\n+          offset += child.nodeValue.length;\n+        else if (child.nodeType == 1) {\n+          result.push({\n+            event: 'start',\n+            offset: offset,\n+            node: child\n+          });\n+          offset = _nodeStream(child, offset);\n+          // Prevent void elements from having an end tag that would actually\n+          // double them in the output. There are more void elements in HTML\n+          // but we list only those realistically expected in code display.\n+          if (!tag(child).match(/br|hr|img|input/)) {\n+            result.push({\n+              event: 'stop',\n+              offset: offset,\n+              node: child\n+            });\n+          }\n+        }\n+      }\n+      return offset;\n+    })(node, 0);\n+    return result;\n+  }\n+\n+  function mergeStreams(original, highlighted, value) {\n+    var processed = 0;\n+    var result = '';\n+    var nodeStack = [];\n+\n+    function selectStream() {\n+      if (!original.length || !highlighted.length) {\n+        return original.length ? original : highlighted;\n+      }\n+      if (original[0].offset != highlighted[0].offset) {\n+        return (original[0].offset < highlighted[0].offset) ? original : highlighted;\n+      }\n+\n+      /*\n+       To avoid starting the stream just before it should stop the order is\n+       ensured that original always starts first and closes last:\n+       if (event1 == 'start' && event2 == 'start')\n+       return original;\n+       if (event1 == 'start' && event2 == 'stop')\n+       return highlighted;\n+       if (event1 == 'stop' && event2 == 'start')\n+       return original;\n+       if (event1 == 'stop' && event2 == 'stop')\n+       return highlighted;","path":"src/ui/js/diff2html-ui.js","position":168,"original_position":168,"commit_id":"93721e7e9848583615009bb7dc0229c62a3b599f","original_commit_id":"93721e7e9848583615009bb7dc0229c62a3b599f","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Expected '===' and instead saw '=='.](https://www.codacy.com/app/Codacy/diff2html/file/2536251935/issues/source?bid=3025341&fileBranchId=3284226#l274)","created_at":"2016-05-09T17:27:16Z","updated_at":"2016-05-09T17:27:16Z","html_url":"https://github.com/rtfpessoa/diff2html/pull/76#discussion_r62537869","pull_request_url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/comments/62537869"},"html":{"href":"https://github.com/rtfpessoa/diff2html/pull/76#discussion_r62537869"},"pull_request":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76","id":69282727,"html_url":"https://github.com/rtfpessoa/diff2html/pull/76","diff_url":"https://github.com/rtfpessoa/diff2html/pull/76.diff","patch_url":"https://github.com/rtfpessoa/diff2html/pull/76.patch","issue_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues/76","number":76,"state":"open","locked":false,"title":"Improve highlight","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"body":"Fixes #75 ","created_at":"2016-05-08T23:09:14Z","updated_at":"2016-05-09T17:27:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46c80b34dd3d0a67e6e95ed87fd9f8a3730903ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76/commits","review_comments_url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76/comments","review_comment_url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues/76/comments","statuses_url":"https://api.github.com/repos/rtfpessoa/diff2html/statuses/93721e7e9848583615009bb7dc0229c62a3b599f","head":{"label":"rtfpessoa:improve-highlight","ref":"improve-highlight","sha":"93721e7e9848583615009bb7dc0229c62a3b599f","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"repo":{"id":23483401,"name":"diff2html","full_name":"rtfpessoa/diff2html","owner":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rtfpessoa/diff2html","description":"Pretty diff to html javascript library (diff2html)","fork":false,"url":"https://api.github.com/repos/rtfpessoa/diff2html","forks_url":"https://api.github.com/repos/rtfpessoa/diff2html/forks","keys_url":"https://api.github.com/repos/rtfpessoa/diff2html/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rtfpessoa/diff2html/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rtfpessoa/diff2html/teams","hooks_url":"https://api.github.com/repos/rtfpessoa/diff2html/hooks","issue_events_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues/events{/number}","events_url":"https://api.github.com/repos/rtfpessoa/diff2html/events","assignees_url":"https://api.github.com/repos/rtfpessoa/diff2html/assignees{/user}","branches_url":"https://api.github.com/repos/rtfpessoa/diff2html/branches{/branch}","tags_url":"https://api.github.com/repos/rtfpessoa/diff2html/tags","blobs_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/refs{/sha}","trees_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rtfpessoa/diff2html/statuses/{sha}","languages_url":"https://api.github.com/repos/rtfpessoa/diff2html/languages","stargazers_url":"https://api.github.com/repos/rtfpessoa/diff2html/stargazers","contributors_url":"https://api.github.com/repos/rtfpessoa/diff2html/contributors","subscribers_url":"https://api.github.com/repos/rtfpessoa/diff2html/subscribers","subscription_url":"https://api.github.com/repos/rtfpessoa/diff2html/subscription","commits_url":"https://api.github.com/repos/rtfpessoa/diff2html/commits{/sha}","git_commits_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/commits{/sha}","comments_url":"https://api.github.com/repos/rtfpessoa/diff2html/comments{/number}","issue_comment_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues/comments{/number}","contents_url":"https://api.github.com/repos/rtfpessoa/diff2html/contents/{+path}","compare_url":"https://api.github.com/repos/rtfpessoa/diff2html/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rtfpessoa/diff2html/merges","archive_url":"https://api.github.com/repos/rtfpessoa/diff2html/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rtfpessoa/diff2html/downloads","issues_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues{/number}","pulls_url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls{/number}","milestones_url":"https://api.github.com/repos/rtfpessoa/diff2html/milestones{/number}","notifications_url":"https://api.github.com/repos/rtfpessoa/diff2html/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rtfpessoa/diff2html/labels{/name}","releases_url":"https://api.github.com/repos/rtfpessoa/diff2html/releases{/id}","deployments_url":"https://api.github.com/repos/rtfpessoa/diff2html/deployments","created_at":"2014-08-30T02:51:49Z","updated_at":"2016-05-09T03:29:56Z","pushed_at":"2016-05-09T17:21:55Z","git_url":"git://github.com/rtfpessoa/diff2html.git","ssh_url":"git@github.com:rtfpessoa/diff2html.git","clone_url":"https://github.com/rtfpessoa/diff2html.git","svn_url":"https://github.com/rtfpessoa/diff2html","homepage":"https://rtfpessoa.github.com/diff2html","size":829,"stargazers_count":127,"watchers_count":127,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":127,"default_branch":"master"}},"base":{"label":"rtfpessoa:master","ref":"master","sha":"9aa50909a7a3cfdcddea62cfa81bc74b75ea3d4b","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"repo":{"id":23483401,"name":"diff2html","full_name":"rtfpessoa/diff2html","owner":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rtfpessoa/diff2html","description":"Pretty diff to html javascript library (diff2html)","fork":false,"url":"https://api.github.com/repos/rtfpessoa/diff2html","forks_url":"https://api.github.com/repos/rtfpessoa/diff2html/forks","keys_url":"https://api.github.com/repos/rtfpessoa/diff2html/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rtfpessoa/diff2html/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rtfpessoa/diff2html/teams","hooks_url":"https://api.github.com/repos/rtfpessoa/diff2html/hooks","issue_events_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues/events{/number}","events_url":"https://api.github.com/repos/rtfpessoa/diff2html/events","assignees_url":"https://api.github.com/repos/rtfpessoa/diff2html/assignees{/user}","branches_url":"https://api.github.com/repos/rtfpessoa/diff2html/branches{/branch}","tags_url":"https://api.github.com/repos/rtfpessoa/diff2html/tags","blobs_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/refs{/sha}","trees_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rtfpessoa/diff2html/statuses/{sha}","languages_url":"https://api.github.com/repos/rtfpessoa/diff2html/languages","stargazers_url":"https://api.github.com/repos/rtfpessoa/diff2html/stargazers","contributors_url":"https://api.github.com/repos/rtfpessoa/diff2html/contributors","subscribers_url":"https://api.github.com/repos/rtfpessoa/diff2html/subscribers","subscription_url":"https://api.github.com/repos/rtfpessoa/diff2html/subscription","commits_url":"https://api.github.com/repos/rtfpessoa/diff2html/commits{/sha}","git_commits_url":"https://api.github.com/repos/rtfpessoa/diff2html/git/commits{/sha}","comments_url":"https://api.github.com/repos/rtfpessoa/diff2html/comments{/number}","issue_comment_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues/comments{/number}","contents_url":"https://api.github.com/repos/rtfpessoa/diff2html/contents/{+path}","compare_url":"https://api.github.com/repos/rtfpessoa/diff2html/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rtfpessoa/diff2html/merges","archive_url":"https://api.github.com/repos/rtfpessoa/diff2html/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rtfpessoa/diff2html/downloads","issues_url":"https://api.github.com/repos/rtfpessoa/diff2html/issues{/number}","pulls_url":"https://api.github.com/repos/rtfpessoa/diff2html/pulls{/number}","milestones_url":"https://api.github.com/repos/rtfpessoa/diff2html/milestones{/number}","notifications_url":"https://api.github.com/repos/rtfpessoa/diff2html/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rtfpessoa/diff2html/labels{/name}","releases_url":"https://api.github.com/repos/rtfpessoa/diff2html/releases{/id}","deployments_url":"https://api.github.com/repos/rtfpessoa/diff2html/deployments","created_at":"2014-08-30T02:51:49Z","updated_at":"2016-05-09T03:29:56Z","pushed_at":"2016-05-09T17:21:55Z","git_url":"git://github.com/rtfpessoa/diff2html.git","ssh_url":"git@github.com:rtfpessoa/diff2html.git","clone_url":"https://github.com/rtfpessoa/diff2html.git","svn_url":"https://github.com/rtfpessoa/diff2html","homepage":"https://rtfpessoa.github.com/diff2html","size":829,"stargazers_count":127,"watchers_count":127,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":127,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76"},"html":{"href":"https://github.com/rtfpessoa/diff2html/pull/76"},"issue":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/issues/76"},"comments":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/rtfpessoa/diff2html/statuses/93721e7e9848583615009bb7dc0229c62a3b599f"}}}}