All Projects → benrbray → Prosemirror Math

benrbray / Prosemirror Math

Licence: mit
Schema and plugins for "first-class" math support in ProseMirror!

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Prosemirror Math

Yawysiwygee
Yet another what-you-see-is-what-you-get equation editor
Stars: ✭ 60 (+39.53%)
Mutual labels:  math, wysiwyg
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (+355.81%)
Mutual labels:  math, katex
Rich Text Editor
Math editor (http://digabi.github.io/rich-text-editor/)
Stars: ✭ 45 (+4.65%)
Mutual labels:  math, wysiwyg
Yii2 Quill
Yii 2 implementation of Quill, modern WYSIWYG editor
Stars: ✭ 52 (+20.93%)
Mutual labels:  katex, wysiwyg
augmath
Interactive Computer Algebra System. Augmenting how we *do* mathematics using computers
Stars: ✭ 41 (-4.65%)
Mutual labels:  math, katex
Dominhhai.github.io
My Blog
Stars: ✭ 8 (-81.4%)
Mutual labels:  math, katex
Remark Math
remark and rehype plugins to support math
Stars: ✭ 129 (+200%)
Mutual labels:  math, katex
Katex
Fast math typesetting for the web.
Stars: ✭ 14,623 (+33906.98%)
Mutual labels:  math, katex
vscode-markdown-editor
A vscode extension to make your vscode become a full-featured WYSIWYG markdown editor
Stars: ✭ 249 (+479.07%)
Mutual labels:  wysiwyg, katex
react-katex
Display math in TeX with KaTeX and ReactJS
Stars: ✭ 135 (+213.95%)
Mutual labels:  math, katex
React Katex
Display math in TeX with KaTeX and ReactJS
Stars: ✭ 345 (+702.33%)
Mutual labels:  math, katex
showdown-katex
Math typesetting for showdown
Stars: ✭ 32 (-25.58%)
Mutual labels:  math, katex
Mdmath
LaTeX Math for Markdown inside of Visual Studio Code.
Stars: ✭ 675 (+1469.77%)
Mutual labels:  math, katex
Formulador
Render math formulas in 2D in your terminal!
Stars: ✭ 33 (-23.26%)
Mutual labels:  math
Awesome Medium Editor
Medium.com WYSIWYG editor clone, with RTL support.
Stars: ✭ 12 (-72.09%)
Mutual labels:  wysiwyg
Percent
📈 Percent control done right
Stars: ✭ 7 (-83.72%)
Mutual labels:  math
Sharpmath
A small .NET math library.
Stars: ✭ 36 (-16.28%)
Mutual labels:  math
Swiftmath
Cross-platform math library with SIMD support
Stars: ✭ 30 (-30.23%)
Mutual labels:  math
Hx Mathparser
Evaluates math expressions. Written in Haxe.
Stars: ✭ 7 (-83.72%)
Mutual labels:  math
Vue Html5 Editor
An html5 wysiwyg editor for vue
Stars: ✭ 937 (+2079.07%)
Mutual labels:  wysiwyg

prosemirror-math

Overview

This project provides schema and plugins for writing mathematics using ProseMirror. Written in TypeScript, with math rendering handled by KaTeX. Bundle locally with parcel index.html.

The important files in this project are:

  • src/math-schema.ts: A minimal ProseMirror schema supporting inline and display math nodes.
  • src/math-nodeview.ts: A NodeView responsible for rendering and editing math nodes.
  • style/math.css: Contains all necessary styling for math nodes to display correctly. This file can easily be modified to achieve your desired appearance.

To test locally, clone the repository and run

> npm install
> npm run dev

A local development server should become available at http://localhost:1234.

Examples

Unlike other editors, this plugin treats math as part of the text itself, rather than as an "atom" that can only be edited through a dialog box. For example, inline math nodes can be edited directly by bringing the cursor inside of them:

edit inline math

Display math supports multiline editing, as shown below:

edit display math

To create a new math expression, simply enclose LaTeX math notation in dollar signs, like $x+y=5$. When you finish typing, a new math node will be automatically created:

create inline math

To start a display math block, create a blank line and type $$ followed by a space. A multiline editor will appear. To exit the block, press Ctrl-Space or navigate away the mouse or arrow keys.

create display math

Usage

See the full example in src/index.ts. At a minimum, you need to include:

  1. The math_inline and math_display schema found in src/math-schema.ts
  2. The mathPlugin ProseMirror plugin found in src/math-plugin.ts

There are also several optional features you can enable:

  1. (work in progress) Use mathBackspace to backspace "into" a math node, rather than deleting the entire node.
  2. (work in progress--may be quite slow!) Use the mathSelectPlugin to make math node selections less visually jarring.
  3. Use mathInputRules to automatically create new math blocks when typing:
    • Create a new inline math node by typing a dollar-sign-delimited expression like $\int_a^b f(x) dx$ followed by a space.
    • Create a new block math node by typing $$ followed by a space.

TODO

  • [ ] Encapsulate available math plugins to an options object passed on initialization
  • [ ] Wrap nodeViews + katexMacros as a ProseMirror plugin object
  • [ ] Test in FireFox, Safari, Edge
  • [ ] Smart backspace for block math
  • [ ] Delete empty math block on backspace
  • [ ] Support a render callback function, allowing use of MathJax / MathLive instead of KaTeX
  • [ ] Write as many tests as possible
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].