{"action":"created","comment":{"url":"https://api.github.com/repos/Khan/KaTeX/pulls/comments/187011464","pull_request_review_id":118703241,"id":187011464,"diff_hunk":"@@ -692,16 +692,28 @@ const spacingFunctions: {[string]: {| size: string, className: string |}} = {\n         size: \"-0.16667em\",\n         className: \"negativethinspace\",\n     },\n+    \"\\\\nobreak\": {\n+        size: \"0em\",\n+        className: \"nobreak\",\n+    },\n+    \"\\\\allowbreak\": {\n+        size: \"0em\",\n+        className: \"allowbreak\",\n+    },\n };\n \n // A lookup table to determine whether a spacing function/symbol should be\n // treated like a regular space character.\n-const regularSpace: {[string]: boolean} = {\n-    \" \": true,\n-    \"\\\\ \": true,\n-    \"~\": true,\n-    \"\\\\space\": true,\n-    \"\\\\nobreakspace\": true,\n+const regularSpace: {[string]: { className?: string }} = {","path":"src/buildCommon.js","position":22,"original_position":22,"commit_id":"de1b59d5c76b2349b44511d18d0935dde0ef7e31","original_commit_id":"de1b59d5c76b2349b44511d18d0935dde0ef7e31","user":{"login":"edemaine","id":2218736,"avatar_url":"https://avatars1.githubusercontent.com/u/2218736?v=4","gravatar_id":"","url":"https://api.github.com/users/edemaine","html_url":"https://github.com/edemaine","followers_url":"https://api.github.com/users/edemaine/followers","following_url":"https://api.github.com/users/edemaine/following{/other_user}","gists_url":"https://api.github.com/users/edemaine/gists{/gist_id}","starred_url":"https://api.github.com/users/edemaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edemaine/subscriptions","organizations_url":"https://api.github.com/users/edemaine/orgs","repos_url":"https://api.github.com/users/edemaine/repos","events_url":"https://api.github.com/users/edemaine/events{/privacy}","received_events_url":"https://api.github.com/users/edemaine/received_events","type":"User","site_admin":false},"body":"It seems to be this bug: https://github.com/facebook/flow/issues/2977","created_at":"2018-05-09T11:37:35Z","updated_at":"2018-05-09T11:37:36Z","html_url":"https://github.com/Khan/KaTeX/pull/1287#discussion_r187011464","pull_request_url":"https://api.github.com/repos/Khan/KaTeX/pulls/1287","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/comments/187011464"},"html":{"href":"https://github.com/Khan/KaTeX/pull/1287#discussion_r187011464"},"pull_request":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1287"}},"in_reply_to_id":187006930},"pull_request":{"url":"https://api.github.com/repos/Khan/KaTeX/pulls/1287","id":186010576,"html_url":"https://github.com/Khan/KaTeX/pull/1287","diff_url":"https://github.com/Khan/KaTeX/pull/1287.diff","patch_url":"https://github.com/Khan/KaTeX/pull/1287.patch","issue_url":"https://api.github.com/repos/Khan/KaTeX/issues/1287","number":1287,"state":"open","locked":false,"title":"Line breaks for inline formulas","user":{"login":"edemaine","id":2218736,"avatar_url":"https://avatars1.githubusercontent.com/u/2218736?v=4","gravatar_id":"","url":"https://api.github.com/users/edemaine","html_url":"https://github.com/edemaine","followers_url":"https://api.github.com/users/edemaine/followers","following_url":"https://api.github.com/users/edemaine/following{/other_user}","gists_url":"https://api.github.com/users/edemaine/gists{/gist_id}","starred_url":"https://api.github.com/users/edemaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edemaine/subscriptions","organizations_url":"https://api.github.com/users/edemaine/orgs","repos_url":"https://api.github.com/users/edemaine/repos","events_url":"https://api.github.com/users/edemaine/events{/privacy}","received_events_url":"https://api.github.com/users/edemaine/received_events","type":"User","site_admin":false},"body":"Allow for line breaks in inline formulas according to TeX's rules.  Display formulas are not affected.  Part of #327, specifically the plan suggested in https://github.com/Khan/KaTeX/issues/327#issuecomment-352278017\r\n\r\nThe TeXBook [[p.173](http://www.ctex.org/documents/shredder/src/texbook.pdf#page=184)] says \"A formula will be broken only after a relation symbol like $=$ or $<$ or $\\rightarrow$, or after a binary operation symbol like $+$ or $-$ or $\\times$, where the relation or binary operation is on the ``outer level'' of the formula (i.e., not enclosed in {...} and not part of an \\over construction).\"\r\n\r\nIn inline math, we break the outer `katex-html` into multiple `base` spans, splitting wherever a line break can be (in particular, right after top-level `mop` or `mbin`).  Each `base` span gets its own strut, which handles vertical spacing between lines properly.  This was easier than I thought it'd be!\r\n\r\nIn addition, I added support for `\\allowbreak` and `\\nobreak` which modify this behavior.  By also marking them as (zero-width) spaces, I believe they don't affect anything else about layout.\r\n\r\nExamples from the test server with `display=0` set:\r\n\r\n![image](https://user-images.githubusercontent.com/2218736/39634952-1b82ceca-4f8a-11e8-9b68-55eadc755a67.png)\r\n\r\n![image](https://user-images.githubusercontent.com/2218736/39634976-276c92fc-4f8a-11e8-94e2-dd1957a02bb4.png)\r\n\r\n![image](https://user-images.githubusercontent.com/2218736/39634993-3573a106-4f8a-11e8-8df1-b2e8649c6fd7.png)\r\n\r\n![image](https://user-images.githubusercontent.com/2218736/39635030-5025fd6e-4f8a-11e8-9562-b514ea45ed0e.png)\r\n\r\n![image](https://user-images.githubusercontent.com/2218736/39635049-5b3a74e6-4f8a-11e8-8690-edd6980b31f4.png)\r\n\r\n![image](https://user-images.githubusercontent.com/2218736/39635195-c31c6376-4f8a-11e8-8bd6-bcf3a60656c3.png)\r\n","created_at":"2018-05-04T15:04:14Z","updated_at":"2018-05-09T11:37:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"862a5e366c5dd91c4e3f4451b49e04ea4978f382","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Khan/KaTeX/pulls/1287/commits","review_comments_url":"https://api.github.com/repos/Khan/KaTeX/pulls/1287/comments","review_comment_url":"https://api.github.com/repos/Khan/KaTeX/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Khan/KaTeX/issues/1287/comments","statuses_url":"https://api.github.com/repos/Khan/KaTeX/statuses/de1b59d5c76b2349b44511d18d0935dde0ef7e31","head":{"label":"edemaine:inlinebreak","ref":"inlinebreak","sha":"de1b59d5c76b2349b44511d18d0935dde0ef7e31","user":{"login":"edemaine","id":2218736,"avatar_url":"https://avatars1.githubusercontent.com/u/2218736?v=4","gravatar_id":"","url":"https://api.github.com/users/edemaine","html_url":"https://github.com/edemaine","followers_url":"https://api.github.com/users/edemaine/followers","following_url":"https://api.github.com/users/edemaine/following{/other_user}","gists_url":"https://api.github.com/users/edemaine/gists{/gist_id}","starred_url":"https://api.github.com/users/edemaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edemaine/subscriptions","organizations_url":"https://api.github.com/users/edemaine/orgs","repos_url":"https://api.github.com/users/edemaine/repos","events_url":"https://api.github.com/users/edemaine/events{/privacy}","received_events_url":"https://api.github.com/users/edemaine/received_events","type":"User","site_admin":false},"repo":{"id":77924636,"name":"KaTeX","full_name":"edemaine/KaTeX","owner":{"login":"edemaine","id":2218736,"avatar_url":"https://avatars1.githubusercontent.com/u/2218736?v=4","gravatar_id":"","url":"https://api.github.com/users/edemaine","html_url":"https://github.com/edemaine","followers_url":"https://api.github.com/users/edemaine/followers","following_url":"https://api.github.com/users/edemaine/following{/other_user}","gists_url":"https://api.github.com/users/edemaine/gists{/gist_id}","starred_url":"https://api.github.com/users/edemaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edemaine/subscriptions","organizations_url":"https://api.github.com/users/edemaine/orgs","repos_url":"https://api.github.com/users/edemaine/repos","events_url":"https://api.github.com/users/edemaine/events{/privacy}","received_events_url":"https://api.github.com/users/edemaine/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edemaine/KaTeX","description":"Fast math typesetting for the web.","fork":true,"url":"https://api.github.com/repos/edemaine/KaTeX","forks_url":"https://api.github.com/repos/edemaine/KaTeX/forks","keys_url":"https://api.github.com/repos/edemaine/KaTeX/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edemaine/KaTeX/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edemaine/KaTeX/teams","hooks_url":"https://api.github.com/repos/edemaine/KaTeX/hooks","issue_events_url":"https://api.github.com/repos/edemaine/KaTeX/issues/events{/number}","events_url":"https://api.github.com/repos/edemaine/KaTeX/events","assignees_url":"https://api.github.com/repos/edemaine/KaTeX/assignees{/user}","branches_url":"https://api.github.com/repos/edemaine/KaTeX/branches{/branch}","tags_url":"https://api.github.com/repos/edemaine/KaTeX/tags","blobs_url":"https://api.github.com/repos/edemaine/KaTeX/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edemaine/KaTeX/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edemaine/KaTeX/git/refs{/sha}","trees_url":"https://api.github.com/repos/edemaine/KaTeX/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edemaine/KaTeX/statuses/{sha}","languages_url":"https://api.github.com/repos/edemaine/KaTeX/languages","stargazers_url":"https://api.github.com/repos/edemaine/KaTeX/stargazers","contributors_url":"https://api.github.com/repos/edemaine/KaTeX/contributors","subscribers_url":"https://api.github.com/repos/edemaine/KaTeX/subscribers","subscription_url":"https://api.github.com/repos/edemaine/KaTeX/subscription","commits_url":"https://api.github.com/repos/edemaine/KaTeX/commits{/sha}","git_commits_url":"https://api.github.com/repos/edemaine/KaTeX/git/commits{/sha}","comments_url":"https://api.github.com/repos/edemaine/KaTeX/comments{/number}","issue_comment_url":"https://api.github.com/repos/edemaine/KaTeX/issues/comments{/number}","contents_url":"https://api.github.com/repos/edemaine/KaTeX/contents/{+path}","compare_url":"https://api.github.com/repos/edemaine/KaTeX/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edemaine/KaTeX/merges","archive_url":"https://api.github.com/repos/edemaine/KaTeX/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edemaine/KaTeX/downloads","issues_url":"https://api.github.com/repos/edemaine/KaTeX/issues{/number}","pulls_url":"https://api.github.com/repos/edemaine/KaTeX/pulls{/number}","milestones_url":"https://api.github.com/repos/edemaine/KaTeX/milestones{/number}","notifications_url":"https://api.github.com/repos/edemaine/KaTeX/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edemaine/KaTeX/labels{/name}","releases_url":"https://api.github.com/repos/edemaine/KaTeX/releases{/id}","deployments_url":"https://api.github.com/repos/edemaine/KaTeX/deployments","created_at":"2017-01-03T14:34:12Z","updated_at":"2018-02-14T07:30:19Z","pushed_at":"2018-05-09T11:33:59Z","git_url":"git://github.com/edemaine/KaTeX.git","ssh_url":"git@github.com:edemaine/KaTeX.git","clone_url":"https://github.com/edemaine/KaTeX.git","svn_url":"https://github.com/edemaine/KaTeX","homepage":"https://khan.github.io/KaTeX/","size":26238,"stargazers_count":1,"watchers_count":1,"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},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"Khan:master","ref":"master","sha":"5c159abfbb4d0ad558efe500ec9657d2ff6d2d67","user":{"login":"Khan","id":15455,"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,"name":"KaTeX","full_name":"Khan/KaTeX","owner":{"login":"Khan","id":15455,"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-05-09T11:00:21Z","pushed_at":"2018-05-09T11:34:00Z","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":26842,"stargazers_count":8225,"watchers_count":8225,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":573,"mirror_url":null,"archived":false,"open_issues_count":209,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":573,"open_issues":209,"watchers":8225,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1287"},"html":{"href":"https://github.com/Khan/KaTeX/pull/1287"},"issue":{"href":"https://api.github.com/repos/Khan/KaTeX/issues/1287"},"comments":{"href":"https://api.github.com/repos/Khan/KaTeX/issues/1287/comments"},"review_comments":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1287/comments"},"review_comment":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Khan/KaTeX/pulls/1287/commits"},"statuses":{"href":"https://api.github.com/repos/Khan/KaTeX/statuses/de1b59d5c76b2349b44511d18d0935dde0ef7e31"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"edemaine"}}