{"action":"opened","issue":{"url":"https://api.github.com/repos/mdx-js/mdx/issues/145","repository_url":"https://api.github.com/repos/mdx-js/mdx","labels_url":"https://api.github.com/repos/mdx-js/mdx/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/mdx-js/mdx/issues/145/comments","events_url":"https://api.github.com/repos/mdx-js/mdx/issues/145/events","html_url":"https://github.com/mdx-js/mdx/issues/145","id":324068988,"number":145,"title":"Problem using remark-math with MDX","user":{"login":"KrofDrakula","id":112161,"avatar_url":"https://avatars2.githubusercontent.com/u/112161?v=4","gravatar_id":"","url":"https://api.github.com/users/KrofDrakula","html_url":"https://github.com/KrofDrakula","followers_url":"https://api.github.com/users/KrofDrakula/followers","following_url":"https://api.github.com/users/KrofDrakula/following{/other_user}","gists_url":"https://api.github.com/users/KrofDrakula/gists{/gist_id}","starred_url":"https://api.github.com/users/KrofDrakula/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrofDrakula/subscriptions","organizations_url":"https://api.github.com/users/KrofDrakula/orgs","repos_url":"https://api.github.com/users/KrofDrakula/repos","events_url":"https://api.github.com/users/KrofDrakula/events{/privacy}","received_events_url":"https://api.github.com/users/KrofDrakula/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-17T15:15:45Z","updated_at":"2018-05-17T15:15:45Z","closed_at":null,"author_association":"NONE","body":"I've been trying to plug in the KaTeX renderer into the chain of plugins for MDX, but so far, I'm stuck with with some of the formulae incorrectly rendering.\r\n\r\nMy webpack `rules` part is as follows:\r\n\r\n```\r\n{\r\n  test: /\\.mdx$/,\r\n  use: [\r\n    ...babelLoader,\r\n    {\r\n      loader: '@mdx-js/loader',\r\n      options: {\r\n        mdPlugins: [math],\r\n        hastPlugins: [katex]\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n...where `math` and `katex` are the packages `remark-math` and `rehype-katex`, respectively. I'm using `preact` and `preact-compat` with the following aliases:\r\n\r\n```\r\nalias: {\r\n  react: 'preact-compat/dist/preact-compat',\r\n  'react-dom': 'preact-compat/dist/preact-compat',\r\n  'react-addons-create-fragment': 'preact-compat/dist/preact-compat'\r\n}\r\n```\r\n\r\nTo illustrate the problem, I'm trying to render the following page:\r\n\r\n```\r\nimport 'katex/dist/katex.css';\r\nimport { h } from 'preact';\r\n\r\n## Math test\r\n\r\n$$\r\n\\sum{1}\r\n$$\r\n\r\n$$\r\n\\sum{i}\r\n$$\r\n```\r\n\r\nThe first equation renders fine, since `1` is a literal and is just converted to a string in the JSX. However, the second equation uses `{i}` in the rendered JSX and tries to evaluate the `i`, which fails because `i` is `undefined`˙.\r\n\r\nIs there a way to have JSX be ignored or forced to escape in the math portion of the MDX?"}}
{"actor":{"display_login":"KrofDrakula"}}