{"action":"created","comment":{"url":"https://api.github.com/repos/Khan/KaTeX/pulls/comments/203236754","pull_request_review_id":138085994,"id":203236754,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzIzNjc1NA==","diff_hunk":"@@ -103,29 +119,35 @@ export const getVariant = function(group, options) {\n  * MathML nodes.  Also combine consecutive <mtext> outputs into a single\n  * <mtext> tag.\n  */\n-export const buildExpression = function(expression, options) {\n+export const buildExpression = function(\n+    expression: AnyParseNode[],\n+    options: Options,\n+): MathDomNode[] {\n     const groups = [];\n     let lastGroup;\n     for (let i = 0; i < expression.length; i++) {\n         const group = buildGroup(expression[i], options);\n-        // Concatenate adjacent <mtext>s\n-        if (group.type === 'mtext' && lastGroup && lastGroup.type === 'mtext'\n-            && group.getAttribute('mathvariant') ===\n-               lastGroup.getAttribute('mathvariant')) {\n-            lastGroup.children.push(...group.children);\n-        // Concatenate adjacent <mn>s\n-        } else if (group.type === 'mn' &&\n-                   lastGroup && lastGroup.type === 'mn') {\n-            lastGroup.children.push(...group.children);\n-        // Concatenate <mn>...</mn> followed by <mi>.</mi>\n-        } else if (group.type === 'mi' && group.children.length === 1 &&\n-                   group.children[0].text === '.' &&\n-                   lastGroup && lastGroup.type === 'mn') {\n-            lastGroup.children.push(...group.children);\n-        } else {\n-            groups.push(group);\n-            lastGroup = group;\n+        if (group instanceof MathNode && lastGroup instanceof MathNode) {\n+            // Concatenate adjacent <mtext>s\n+            if (group.type === 'mtext' && lastGroup.type === 'mtext'\n+                && group.getAttribute('mathvariant') ===\n+                   lastGroup.getAttribute('mathvariant')) {\n+                lastGroup.children.push(...group.children);\n+                continue;\n+            // Concatenate adjacent <mn>s\n+            } else if (group.type === 'mn' && lastGroup.type === 'mn') {\n+                lastGroup.children.push(...group.children);\n+                continue;\n+            // Concatenate <mn>...</mn> followed by <mi>.</mi>\n+            } else if (group.type === 'mi' && group.children.length === 1 &&\n+                       assertType(group.children[0], TextNode).text === '.' &&","path":"src/buildMathML.js","position":95,"original_position":95,"commit_id":"2d506eb3fe953f019a5bd13ed1905474dfc2ac5d","original_commit_id":"2d506eb3fe953f019a5bd13ed1905474dfc2ac5d","user":{"login":"marcianx","id":370338,"node_id":"MDQ6VXNlcjM3MDMzOA==","avatar_url":"https://avatars3.githubusercontent.com/u/370338?v=4","gravatar_id":"","url":"https://api.github.com/users/marcianx","html_url":"https://github.com/marcianx","followers_url":"https://api.github.com/users/marcianx/followers","following_url":"https://api.github.com/users/marcianx/following{/other_user}","gists_url":"https://api.github.com/users/marcianx/gists{/gist_id}","starred_url":"https://api.github.com/users/marcianx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcianx/subscriptions","organizations_url":"https://api.github.com/users/marcianx/orgs","repos_url":"https://api.github.com/users/marcianx/repos","events_url":"https://api.github.com/users/marcianx/events{/privacy}","received_events_url":"https://api.github.com/users/marcianx/received_events","type":"User","site_admin":false},"body":"It definitely seems to be the case. I've not been able to come up with a counterexample so far, but I also have not definitively prove it in the `\\operatorname` case. In any case, I changed this to be more conservative about the assumptions.","created_at":"2018-07-18T02:38:44Z","updated_at":"2018-07-18T02:38:44Z","html_url":"https://github.com/Khan/KaTeX/pull/1486#discussion_r203236754","pull_request_url":"https://api.github.com/repos/Khan/KaTeX/pulls/1486","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/comments/203236754"},"html":{"href":"https://github.com/Khan/KaTeX/pull/1486#discussion_r203236754"},"pull_request":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1486"}},"in_reply_to_id":203223107},"pull_request":{"url":"https://api.github.com/repos/Khan/KaTeX/pulls/1486","id":201621238,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxNjIxMjM4","html_url":"https://github.com/Khan/KaTeX/pull/1486","diff_url":"https://github.com/Khan/KaTeX/pull/1486.diff","patch_url":"https://github.com/Khan/KaTeX/pull/1486.patch","issue_url":"https://api.github.com/repos/Khan/KaTeX/issues/1486","number":1486,"state":"open","locked":false,"title":"Port buildMathML to @flow.","user":{"login":"marcianx","id":370338,"node_id":"MDQ6VXNlcjM3MDMzOA==","avatar_url":"https://avatars3.githubusercontent.com/u/370338?v=4","gravatar_id":"","url":"https://api.github.com/users/marcianx","html_url":"https://github.com/marcianx","followers_url":"https://api.github.com/users/marcianx/followers","following_url":"https://api.github.com/users/marcianx/following{/other_user}","gists_url":"https://api.github.com/users/marcianx/gists{/gist_id}","starred_url":"https://api.github.com/users/marcianx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcianx/subscriptions","organizations_url":"https://api.github.com/users/marcianx/orgs","repos_url":"https://api.github.com/users/marcianx/repos","events_url":"https://api.github.com/users/marcianx/events{/privacy}","received_events_url":"https://api.github.com/users/marcianx/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-16T12:25:43Z","updated_at":"2018-07-18T02:38:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1574c7b5f07da6bf1d69a562afa0fb6e3f6026f8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Khan/KaTeX/pulls/1486/commits","review_comments_url":"https://api.github.com/repos/Khan/KaTeX/pulls/1486/comments","review_comment_url":"https://api.github.com/repos/Khan/KaTeX/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Khan/KaTeX/issues/1486/comments","statuses_url":"https://api.github.com/repos/Khan/KaTeX/statuses/2d506eb3fe953f019a5bd13ed1905474dfc2ac5d","head":{"label":"marcianx:flow-builders","ref":"flow-builders","sha":"2d506eb3fe953f019a5bd13ed1905474dfc2ac5d","user":{"login":"marcianx","id":370338,"node_id":"MDQ6VXNlcjM3MDMzOA==","avatar_url":"https://avatars3.githubusercontent.com/u/370338?v=4","gravatar_id":"","url":"https://api.github.com/users/marcianx","html_url":"https://github.com/marcianx","followers_url":"https://api.github.com/users/marcianx/followers","following_url":"https://api.github.com/users/marcianx/following{/other_user}","gists_url":"https://api.github.com/users/marcianx/gists{/gist_id}","starred_url":"https://api.github.com/users/marcianx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcianx/subscriptions","organizations_url":"https://api.github.com/users/marcianx/orgs","repos_url":"https://api.github.com/users/marcianx/repos","events_url":"https://api.github.com/users/marcianx/events{/privacy}","received_events_url":"https://api.github.com/users/marcianx/received_events","type":"User","site_admin":false},"repo":{"id":101701945,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE3MDE5NDU=","name":"KaTeX","full_name":"marcianx/KaTeX","owner":{"login":"marcianx","id":370338,"node_id":"MDQ6VXNlcjM3MDMzOA==","avatar_url":"https://avatars3.githubusercontent.com/u/370338?v=4","gravatar_id":"","url":"https://api.github.com/users/marcianx","html_url":"https://github.com/marcianx","followers_url":"https://api.github.com/users/marcianx/followers","following_url":"https://api.github.com/users/marcianx/following{/other_user}","gists_url":"https://api.github.com/users/marcianx/gists{/gist_id}","starred_url":"https://api.github.com/users/marcianx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcianx/subscriptions","organizations_url":"https://api.github.com/users/marcianx/orgs","repos_url":"https://api.github.com/users/marcianx/repos","events_url":"https://api.github.com/users/marcianx/events{/privacy}","received_events_url":"https://api.github.com/users/marcianx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marcianx/KaTeX","description":"Fast math typesetting for the web.","fork":true,"url":"https://api.github.com/repos/marcianx/KaTeX","forks_url":"https://api.github.com/repos/marcianx/KaTeX/forks","keys_url":"https://api.github.com/repos/marcianx/KaTeX/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marcianx/KaTeX/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marcianx/KaTeX/teams","hooks_url":"https://api.github.com/repos/marcianx/KaTeX/hooks","issue_events_url":"https://api.github.com/repos/marcianx/KaTeX/issues/events{/number}","events_url":"https://api.github.com/repos/marcianx/KaTeX/events","assignees_url":"https://api.github.com/repos/marcianx/KaTeX/assignees{/user}","branches_url":"https://api.github.com/repos/marcianx/KaTeX/branches{/branch}","tags_url":"https://api.github.com/repos/marcianx/KaTeX/tags","blobs_url":"https://api.github.com/repos/marcianx/KaTeX/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marcianx/KaTeX/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marcianx/KaTeX/git/refs{/sha}","trees_url":"https://api.github.com/repos/marcianx/KaTeX/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marcianx/KaTeX/statuses/{sha}","languages_url":"https://api.github.com/repos/marcianx/KaTeX/languages","stargazers_url":"https://api.github.com/repos/marcianx/KaTeX/stargazers","contributors_url":"https://api.github.com/repos/marcianx/KaTeX/contributors","subscribers_url":"https://api.github.com/repos/marcianx/KaTeX/subscribers","subscription_url":"https://api.github.com/repos/marcianx/KaTeX/subscription","commits_url":"https://api.github.com/repos/marcianx/KaTeX/commits{/sha}","git_commits_url":"https://api.github.com/repos/marcianx/KaTeX/git/commits{/sha}","comments_url":"https://api.github.com/repos/marcianx/KaTeX/comments{/number}","issue_comment_url":"https://api.github.com/repos/marcianx/KaTeX/issues/comments{/number}","contents_url":"https://api.github.com/repos/marcianx/KaTeX/contents/{+path}","compare_url":"https://api.github.com/repos/marcianx/KaTeX/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marcianx/KaTeX/merges","archive_url":"https://api.github.com/repos/marcianx/KaTeX/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marcianx/KaTeX/downloads","issues_url":"https://api.github.com/repos/marcianx/KaTeX/issues{/number}","pulls_url":"https://api.github.com/repos/marcianx/KaTeX/pulls{/number}","milestones_url":"https://api.github.com/repos/marcianx/KaTeX/milestones{/number}","notifications_url":"https://api.github.com/repos/marcianx/KaTeX/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marcianx/KaTeX/labels{/name}","releases_url":"https://api.github.com/repos/marcianx/KaTeX/releases{/id}","deployments_url":"https://api.github.com/repos/marcianx/KaTeX/deployments","created_at":"2017-08-29T00:53:41Z","updated_at":"2018-06-10T01:56:26Z","pushed_at":"2018-07-17T00:57:56Z","git_url":"git://github.com/marcianx/KaTeX.git","ssh_url":"git@github.com:marcianx/KaTeX.git","clone_url":"https://github.com/marcianx/KaTeX.git","svn_url":"https://github.com/marcianx/KaTeX","homepage":"https://khan.github.io/KaTeX/","size":26571,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Khan:master","ref":"master","sha":"8f5239c27236b5816f78be0ac8edca1181e37c20","user":{"login":"Khan","id":15455,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDU1","avatar_url":"https://avatars1.githubusercontent.com/u/15455?v=4","gravatar_id":"","url":"https://api.github.com/users/Khan","html_url":"https://github.com/Khan","followers_url":"https://api.github.com/users/Khan/followers","following_url":"https://api.github.com/users/Khan/following{/other_user}","gists_url":"https://api.github.com/users/Khan/gists{/gist_id}","starred_url":"https://api.github.com/users/Khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Khan/subscriptions","organizations_url":"https://api.github.com/users/Khan/orgs","repos_url":"https://api.github.com/users/Khan/repos","events_url":"https://api.github.com/users/Khan/events{/privacy}","received_events_url":"https://api.github.com/users/Khan/received_events","type":"Organization","site_admin":false},"repo":{"id":11195700,"node_id":"MDEwOlJlcG9zaXRvcnkxMTE5NTcwMA==","name":"KaTeX","full_name":"Khan/KaTeX","owner":{"login":"Khan","id":15455,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDU1","avatar_url":"https://avatars1.githubusercontent.com/u/15455?v=4","gravatar_id":"","url":"https://api.github.com/users/Khan","html_url":"https://github.com/Khan","followers_url":"https://api.github.com/users/Khan/followers","following_url":"https://api.github.com/users/Khan/following{/other_user}","gists_url":"https://api.github.com/users/Khan/gists{/gist_id}","starred_url":"https://api.github.com/users/Khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Khan/subscriptions","organizations_url":"https://api.github.com/users/Khan/orgs","repos_url":"https://api.github.com/users/Khan/repos","events_url":"https://api.github.com/users/Khan/events{/privacy}","received_events_url":"https://api.github.com/users/Khan/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Khan/KaTeX","description":"Fast math typesetting for the web.","fork":false,"url":"https://api.github.com/repos/Khan/KaTeX","forks_url":"https://api.github.com/repos/Khan/KaTeX/forks","keys_url":"https://api.github.com/repos/Khan/KaTeX/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Khan/KaTeX/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Khan/KaTeX/teams","hooks_url":"https://api.github.com/repos/Khan/KaTeX/hooks","issue_events_url":"https://api.github.com/repos/Khan/KaTeX/issues/events{/number}","events_url":"https://api.github.com/repos/Khan/KaTeX/events","assignees_url":"https://api.github.com/repos/Khan/KaTeX/assignees{/user}","branches_url":"https://api.github.com/repos/Khan/KaTeX/branches{/branch}","tags_url":"https://api.github.com/repos/Khan/KaTeX/tags","blobs_url":"https://api.github.com/repos/Khan/KaTeX/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Khan/KaTeX/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Khan/KaTeX/git/refs{/sha}","trees_url":"https://api.github.com/repos/Khan/KaTeX/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Khan/KaTeX/statuses/{sha}","languages_url":"https://api.github.com/repos/Khan/KaTeX/languages","stargazers_url":"https://api.github.com/repos/Khan/KaTeX/stargazers","contributors_url":"https://api.github.com/repos/Khan/KaTeX/contributors","subscribers_url":"https://api.github.com/repos/Khan/KaTeX/subscribers","subscription_url":"https://api.github.com/repos/Khan/KaTeX/subscription","commits_url":"https://api.github.com/repos/Khan/KaTeX/commits{/sha}","git_commits_url":"https://api.github.com/repos/Khan/KaTeX/git/commits{/sha}","comments_url":"https://api.github.com/repos/Khan/KaTeX/comments{/number}","issue_comment_url":"https://api.github.com/repos/Khan/KaTeX/issues/comments{/number}","contents_url":"https://api.github.com/repos/Khan/KaTeX/contents/{+path}","compare_url":"https://api.github.com/repos/Khan/KaTeX/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Khan/KaTeX/merges","archive_url":"https://api.github.com/repos/Khan/KaTeX/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Khan/KaTeX/downloads","issues_url":"https://api.github.com/repos/Khan/KaTeX/issues{/number}","pulls_url":"https://api.github.com/repos/Khan/KaTeX/pulls{/number}","milestones_url":"https://api.github.com/repos/Khan/KaTeX/milestones{/number}","notifications_url":"https://api.github.com/repos/Khan/KaTeX/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Khan/KaTeX/labels{/name}","releases_url":"https://api.github.com/repos/Khan/KaTeX/releases{/id}","deployments_url":"https://api.github.com/repos/Khan/KaTeX/deployments","created_at":"2013-07-05T09:01:54Z","updated_at":"2018-07-18T02:18:04Z","pushed_at":"2018-07-18T01:29:47Z","git_url":"git://github.com/Khan/KaTeX.git","ssh_url":"git@github.com:Khan/KaTeX.git","clone_url":"https://github.com/Khan/KaTeX.git","svn_url":"https://github.com/Khan/KaTeX","homepage":"https://khan.github.io/KaTeX/","size":28853,"stargazers_count":8541,"watchers_count":8541,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":586,"mirror_url":null,"archived":false,"open_issues_count":183,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":586,"open_issues":183,"watchers":8541,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1486"},"html":{"href":"https://github.com/Khan/KaTeX/pull/1486"},"issue":{"href":"https://api.github.com/repos/Khan/KaTeX/issues/1486"},"comments":{"href":"https://api.github.com/repos/Khan/KaTeX/issues/1486/comments"},"review_comments":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1486/comments"},"review_comment":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1486/commits"},"statuses":{"href":"https://api.github.com/repos/Khan/KaTeX/statuses/2d506eb3fe953f019a5bd13ed1905474dfc2ac5d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"marcianx"}}