{"id":13805192,"url":"https://github.com/tarjei/draft-js-mathjax-plugin","last_synced_at":"2025-05-06T22:22:42.599Z","repository":{"id":137029764,"uuid":"103538598","full_name":"tarjei/draft-js-mathjax-plugin","owner":"tarjei","description":"Plugin to edit math using (La)TeX (rendered by mathjax) inside draft-js(-editor-plugin). Demo:","archived":false,"fork":false,"pushed_at":"2017-05-09T17:01:17.000Z","size":3182,"stargazers_count":5,"open_issues_count":0,"forks_count":22,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T03:32:13.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://efloti.github.io/draft-js-mathjax-plugin/","language":"JavaScript","has_issues":false,"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/tarjei.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-09-14T13:54:39.000Z","updated_at":"2022-07-15T03:24:25.000Z","dependencies_parsed_at":"2023-03-13T10:58:37.071Z","dependency_job_id":null,"html_url":"https://github.com/tarjei/draft-js-mathjax-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarjei%2Fdraft-js-mathjax-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarjei%2Fdraft-js-mathjax-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarjei%2Fdraft-js-mathjax-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarjei%2Fdraft-js-mathjax-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarjei","download_url":"https://codeload.github.com/tarjei/draft-js-mathjax-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252777366,"owners_count":21802590,"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":[],"created_at":"2024-08-04T01:00:58.450Z","updated_at":"2025-05-06T22:22:42.571Z","avatar_url":"https://github.com/tarjei.png","language":"JavaScript","funding_links":[],"categories":["Plugins and Decorators Built for Draft.js"],"sub_categories":[],"readme":"# DraftJS MathJax Plugin\n\n*This is a plugin for the `draft-js-plugins-editor`.*\n\nThis plugin allows you to edit math rendered by mathjax. [Give it a try!](https://efloti.github.io/draft-js-mathjax-plugin/)\n\nIt uses the traditional `$` key to insert inline math and `CTRL+M` for block one. (Type `\\$` to insert the `$` character)\n\n![demo](https://github.com/efloti/draft-js-mathjax-plugin/raw/master/demo.gif)\n\n## Installation\n\n```\nnpm install draft-js-mathjax-plugin --save\n```\n\n## Usage\n\n```js\nimport React, { Component } from 'react'\nimport { EditorState } from 'draft-js'\nimport Editor from 'draft-js-plugins-editor'\nimport createMathjaxPlugin from 'draft-js-mathjax-plugin'\n\nconst mathjaxPlugin = createMathjaxPlugin(/* optional configuration object */)\n\nconst plugins = [\n  mathjaxPlugin,\n]\n\nexport default class MyEditor extends Component {\n\n  state = {\n    editorState: EditorState.createEmpty(),\n  }\n\n  onChange = (editorState) =\u003e {\n    this.setState({\n      editorState,\n    })\n  }\n\n  render() {\n    return (\n      \u003cEditor\n        editorState={this.state.editorState}\n        onChange={this.onChange}\n        plugins={plugins}\n      /\u003e\n    )\n  }\n}\n```\n\nLearn more [draftjs-plugins](https://github.com/draft-js-plugins/draft-js-plugins)\n\n## Optional configuration Object\n\n  - `macros`: an object to define mathjax macros. Example:\n  \n ```js\n  const mathjaxConfig = {\n    macros: {\n      bold: ['{\\\\bf #1}', 1],\n    },\n  }\n ```\n  \n  see [mathjax doc](http://docs.mathjax.org/en/latest/tex.html?highlight=macros#defining-tex-macros) to find out how to define macros.\n  - `completion` (default: `'auto'`): `'none' | 'manual' | 'auto'`.\n  \n  If you choose `manual`, use `ctrl-\u003cspace\u003e` to launch completion about the current tex command (if any).\n  \n  Use (`Shift`)`Tab` to see each possible completion in turn.\n  - `script` (default: `'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js'`): \n  \n  url to load mathjax from the plugin\n  - `mathjaxConfig`: see [mathjax configuration object](http://docs.mathjax.org/en/latest/options/index.html). The default is:\n  \n  ```js\n  {                                                        \n    jax: ['input/TeX', 'output/CommonHTML'],                                       \n    TeX: {                                                                         \n      extensions: ['autoload-all.js'],                                             \n    },                                                                             \n    messageStyles: 'none',                                                         \n    showProcessingMessages: false,                                                 \n    showMathMenu: false,                                                           \n    showMathMenuMSIE: false,                                                       \n    preview: 'none',                                                               \n    delayStartupTypeset: true,                                                     \n  }\n  ```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarjei%2Fdraft-js-mathjax-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarjei%2Fdraft-js-mathjax-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarjei%2Fdraft-js-mathjax-plugin/lists"}