Giter Site home page Giter Site logo

xiakeweian / mathquill4quill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from c-w/mathquill4quill

0.0 0.0 0.0 224 KB

Power-up Quill's formula editing via the MathQuill editor

Home Page: https://justamouse.com/mathquill4quill/

License: Apache License 2.0

HTML 46.80% JavaScript 53.20%

mathquill4quill's Introduction

MathQuill 4 Quill

Build Status Code Style: prettier License

What's this?

This module adds support for rich math authoring to the Quill editor.

Basic demo of mathquill4quill

Live demo

Usage example

This module depends on MathQuill, Quill and KaTeX, so you'll need to add references to their JS and CSS files in addition to adding a reference to mathquill4quill.js. Official builds as well as minified assets can be found on the releases page.

Next, initialize your Quill object and load the formula module:

// setup quill with formula support

var quill = new Quill('#editor', {
  modules: {
    formula: true,
    toolbar: [['formula']]
  },
  theme: 'snow'
});

Last step: replace Quill's native formula authoring with MathQuill.

// enable mathquill formula editor

quill.enableMathQuillFormulaAuthoring();

Custom operator buttons

You can also add in operator buttons (buttons that allow users not familiar with latex to add in operators/functions like square roots) to the editor by passing an operators variable to the enableMathQuillFormulaAuthoring() function. Example:

quill.enableMathQuillFormulaAuthoring({
  operators: [["\\sqrt[n]{x}", "\\nthroot"], ["\\frac{x}{y}","\\frac"]]
});

The operators variable is an array of arrays. The outside array contains all of the different arrays which describe the operator buttons. The arrays inside of the main array consist of two values. The first value is the latex that gets rendered as the value on the button, and the second value is the latex that gets inserted into the MathQuill editor.

Demo of mathquill4quill with custom operator buttons

Development setup

First, install the development dependencies:

npm install

You can now start the development server using npm start and verify code style compliance using npm run lint.

mathquill4quill's People

Contributors

boomanaiden154 avatar c-w avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.