{"id":16551015,"url":"https://github.com/mehdisadeghi/react-mathjax-preview","last_synced_at":"2025-09-10T19:44:57.135Z","repository":{"id":25422095,"uuid":"103957236","full_name":"mehdisadeghi/react-mathjax-preview","owner":"mehdisadeghi","description":"The MathJax React component you were looking for.","archived":false,"fork":false,"pushed_at":"2022-03-13T10:31:09.000Z","size":3266,"stargazers_count":49,"open_issues_count":9,"forks_count":30,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-08T23:46:43.141Z","etag":null,"topics":["asciimath","mathjax","mathml","react","react-component","tex"],"latest_commit_sha":null,"homepage":"https://mehdisadeghi.github.io/react-mathjax-preview/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mehdisadeghi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-18T15:27:54.000Z","updated_at":"2024-07-01T18:41:33.000Z","dependencies_parsed_at":"2022-08-07T11:15:41.301Z","dependency_job_id":null,"html_url":"https://github.com/mehdisadeghi/react-mathjax-preview","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehdisadeghi%2Freact-mathjax-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehdisadeghi%2Freact-mathjax-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehdisadeghi%2Freact-mathjax-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehdisadeghi%2Freact-mathjax-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mehdisadeghi","download_url":"https://codeload.github.com/mehdisadeghi/react-mathjax-preview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166474,"owners_count":21864467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asciimath","mathjax","mathml","react","react-component","tex"],"created_at":"2024-10-11T19:36:07.428Z","updated_at":"2025-05-08T23:46:48.657Z","avatar_url":"https://github.com/mehdisadeghi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-mathjax-preview\n\n[![Travis][build-badge]][build]\n[![npm package][npm-badge]][npm]\n\n`react-mathjax-preview` provides one React component to render MathML, TeX or ASCIImath formulas. See [demo](https://mehdisadeghi.github.io/react-mathjax-preview/).\n\n## Installation\nInstall `react-mathjax-preview` as a dependency:\n\n```\nyarn add react-mathjax-preview\n```\n\n## Usage\nImport the package and fill the `math` property with some text containing your formals. Wrap TeX in `$` or `$$` and ASCIImath in \\`. Paste MathML as is.\n\n```js\nimport React, {Component} from 'react'\nimport {render} from 'react-dom'\nimport MathJax from 'react-mathjax-preview'\n\nconst asciimath = '`sum_(i=1)^n i^3=((n(n+1))/2)^2`' # Because of the backtick\nconst math = String.raw`\n  \u003cmath xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"\u003e\n    \u003cmenclose notation=\"circle box\"\u003e\n      \u003cmi\u003e x \u003c/mi\u003e\u003cmo\u003e + \u003c/mo\u003e\u003cmi\u003e y \u003c/mi\u003e\n    \u003c/menclose\u003e\n  \u003c/math\u003e\n\n  $$\\lim_{x \\to \\infty} \\exp(-x) = 0$$\n\n  ${asciimath}`\n\nclass Demo extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      math: tex\n    }\n  render() {\n    return \u003cMathJax math={this.state.math} /\u003e\n  }\n}\n```\n\n## Props\n\n### className\nWrapper classname\n\n### id\nWrapper id\n\n### style\nStyle object\n\n### wrapperTag\nWrapper tag, `\"div\"` is default\n\n### math\nMathJax content\n\n### msDelayDisplay\nMilliseconds to delay display of div, 300 is default\n\n### onDisplay (Function)\nTriggered after delay and div is shown, hopefully typeset has finished\n\n### config (Object)\nMathJax configuration\n\n### onLoad (Function)\nTriggered after MathJax script finishes loading before children are allowed to render.\n\n### onError (Function)\nTriggered when any Math Processing Error occurs\n\n### sanitizeOptions\nDOMPurify configuration object (optional). See https://github.com/cure53/DOMPurify#can-i-configure-dompurify\n\n## Development\nClone the repo and run yarn commands available in the `package.json` file.\n\n```\n$ git clone https://github.com/mehdisadeghi/react-mathjax-preview \u0026\u0026 cd react-mathjax-preview\n$ yarn install // install dependencies\n$ yarn start // start the development server which serves the demo page\n$ yarn build // make a production build inside the dist folder\n$ yarn build:demo // make a demo build inside the dist folder\n```\n\nAnd browse to [localhost:3000](http://localhost:3000).\n\n# License\nMIT\n\n[build-badge]: https://img.shields.io/travis/mehdisadeghi/react-mathjax-preview/master\n[build]: https://travis-ci.org/mehdisadeghi/react-mathjax-preview\n\n[npm-badge]: https://img.shields.io/npm/v/react-mathjax-preview\n[npm]: https://www.npmjs.org/package/react-mathjax-preview\n\n[coveralls-badge]: https://img.shields.io/coveralls/mehdisadeghi/react-mathjax-preview/master\n[coveralls]: https://coveralls.io/github/mehdisadeghi/react-mathjax-preview\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehdisadeghi%2Freact-mathjax-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmehdisadeghi%2Freact-mathjax-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehdisadeghi%2Freact-mathjax-preview/lists"}