All Projects → isaul32 → ckeditor5-math

isaul32 / ckeditor5-math

Licence: ISC license
Math feature for CKEditor 5.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to ckeditor5-math

pseudocode.js
Beautiful pseudocode for the Web
Stars: ✭ 132 (+158.82%)
Mutual labels:  mathjax, katex
Liandi
📕 一款桌面端的 Markdown 块级引用和双向链接笔记应用,支持 Windows、Mac 和 Linux。A desktop Markdown Block-Reference and Bidirectional-Link note-taking application, supports Windows, Mac and Linux.
Stars: ✭ 354 (+594.12%)
Mutual labels:  mathjax, katex
purple-pi
💜 LaTeX math wherever you want
Stars: ✭ 31 (-39.22%)
Mutual labels:  mathjax, katex
vscode-markdown-editor
A vscode extension to make your vscode become a full-featured WYSIWYG markdown editor
Stars: ✭ 249 (+388.24%)
Mutual labels:  mathjax, katex
new ckeditor
Ruby on Rails + CKEditor 5
Stars: ✭ 27 (-47.06%)
Mutual labels:  ckeditor, ckeditor5
Spmathkit
Render math exercises for your view. Contains the rendering of mathematical formulas and mathematical graphics, as well as the general text
Stars: ✭ 81 (+58.82%)
Mutual labels:  mathjax, katex
Markdown Preview Enhanced
One of the 'BEST' markdown preview extensions for Atom editor!
Stars: ✭ 3,478 (+6719.61%)
Mutual labels:  mathjax, katex
Ckeditor5
Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
Stars: ✭ 5,406 (+10500%)
Mutual labels:  ckeditor, ckeditor5
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 (+284.31%)
Mutual labels:  mathjax, katex
Flutter tex
A Flutter Package to render Mathematics, Physics and Chemistry Equations based on LaTeX
Stars: ✭ 161 (+215.69%)
Mutual labels:  mathjax, katex
Codebe
CodeBe(码币)是一个是使用angular2整合各种插件的项目,包括(layer,bootstrap-table,markdown编辑器,highcharts,ckeditor,高德地图,fullcalendar 等等)。如果你有什么想要集成的插件,请告诉我,我来加进去。(请给我加个星,谢谢。)
Stars: ✭ 307 (+501.96%)
Mutual labels:  ckeditor, mathjax
notes
Simple text editor for your Markdown and LaTeX notes.
Stars: ✭ 24 (-52.94%)
Mutual labels:  mathjax, katex
Djangocms Text Ckeditor
Text Plugin for django CMS using CKEditor 4
Stars: ✭ 126 (+147.06%)
Mutual labels:  ckeditor
KaTeXView
KaTeX View for android
Stars: ✭ 43 (-15.69%)
Mutual labels:  katex
React Ckeditor
CKEditor component for React with plugin and custom event listeners support
Stars: ✭ 124 (+143.14%)
Mutual labels:  ckeditor
Laravel Filemanager
Media gallery with CKEditor, TinyMCE and Summernote support. Built on Laravel file system.
Stars: ✭ 1,688 (+3209.8%)
Mutual labels:  ckeditor
mathconverter
Converts from AsciiMath, LaTeX, MathML to LaTeX, MathML
Stars: ✭ 35 (-31.37%)
Mutual labels:  mathjax
iOS-HTMLTextEditor
A simple implementation of an HTML Editor using CKEditor in a web view.
Stars: ✭ 57 (+11.76%)
Mutual labels:  ckeditor
Laravel Filemanager Example 5.3
Demo integration for laravel-filemanager (https://github.com/UniSharp/laravel-filemanager).
Stars: ✭ 100 (+96.08%)
Mutual labels:  ckeditor
Frontend editing
TYPO3 CMS frontend editing
Stars: ✭ 98 (+92.16%)
Mutual labels:  ckeditor

CKEditor 5 mathematical feature · GitHub license npm version

ckeditor5-math is a TeX-based mathematical plugin for CKEditor 5. You can use it to insert, edit, and view mathematical equations and formulas. This plugin supports MathJax, KaTeX and custom typesetting engines.

Table of contents

Features

  • TeX syntax
  • Inline and display equations
  • Preview view
  • Multiple typesetting engines
  • Have multiple input and output format
  • Paste support
    • from plain text
  • Autoformat support

Demos

Screenshots

Screenshot 1

Screenshot 2

Requirements

  • Use same major version as your CKEditor 5 build

If you get duplicated modules error, you have mismatching versions.

Examples

Link to examples repository

Installation

Use official classic or inline build as a base:

Install plugin with NPM or Yarn

npm install ckeditor5-math --save-dev

yarn add ckeditor5-math --dev

Add import into ckeditor.js file

import Mathematics from 'ckeditor5-math/src/math';

Add it to built-in plugins

InlineEditor.builtinPlugins = [
	// ...
	Mathematics
];

Add math button to toolbar

InlineEditor.defaultConfig = {
	toolbar: {
		items: [
			// ...
			'math'
		]
	}
};

Styles for Lark theme

Copy theme/ckeditor5-math folder from https://github.com/isaul32/ckeditor5/tree/master/packages/ckeditor5-theme-lark to your lark theme repository

Configuration & Usage

Plugin options

InlineEditor.defaultConfig = {
	// ...
	math: {
		engine: 'mathjax', // or katex or function. E.g. (equation, element, display) => { ... }
		lazyLoad: undefined, // async () => { ... }, called once before rendering first equation if engine doesn't exist. After resolving promise, plugin renders equations.
		outputType: 'script', // or span
		forceOutputType: false, // forces output to use outputType
		enablePreview: true, // Enable preview view
		previewClassName: [], // Class names to add to previews
		popupClassName: [], // Class names to add to math popup balloon
		katexRenderOptions: {}  // KaTeX only options for katex.render(ToString)
	}
}

Available typesetting engines

MathJax

  • Tested with latest 2.7
  • Has experimental (CHTML, SVG) support for 3.0.0 or newer version

KaTeX

KaTeX

  • Tested with version 0.12.0

KaTeX

  • katexRenderOptions - pass options.

    InlineEditor.defaultConfig = {
    	// ...
    	math: {
    		engine: 'katex'
    		katexRenderOptions: {
    			macros: {
    				"\\neq": "\\mathrel{\\char`≠}",
    			},
    		},
    	}
    }

Custom typesetting

Custom typesetting is possible to implement with engine config. For example, custom typesetting feature can be used when use back end rendering.

InlineEditor.defaultConfig = {
	// ...
	math: {
		engine: ( equation, element, display, preview ) => {
			// ...
		}
	}
}
  • equation is equation in TeX format without delimiters.
  • element is DOM element reserved for rendering.
  • display is boolean. Typesetting should be inline when false.
  • preview is boolean. Rendering in preview when true.

Supported input and output formats

Supported input and output formats are:

<!-- MathJax style http://docs.mathjax.org/en/v2.7-latest/advanced/model.html#how-mathematics-is-stored-in-the-page -->
<script type="math/tex">\sqrt{\frac{a}{b}}</script>
<script type="math/tex; mode=display">\sqrt{\frac{a}{b}}</script>

<!-- CKEditor 4 style https://ckeditor.com/docs/ckeditor4/latest/features/mathjax.html -->
<span class="math-tex">\( \sqrt{\frac{a}{b}} \)</span>
<span class="math-tex">\[ \sqrt{\frac{a}{b}} \]</span>

Paste support

From plain text

Paste TeX equations with delimiters. For example:

\[ x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \]

or

\( x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \)

Autoformat support

Inline mode

Ctrl+M can be used to add easily math formulas in inline mode.

Display mode

Autoformat for math can be used to add formula in display mode on a new line by adding \[ or $$. This feature requires additional autoformat plugin to be added.

Add following lines into your build

// ...
import AutoformatMathematics from 'ckeditor5-math/src/autoformatmath';

InlineEditor.builtinPlugins = [
	// ...
	AutoformatMathematics
];

Preview workaround

.ck-reset_all * css rules from ckeditor5-ui and ckeditor5-theme-lark break rendering in preview mode.

My solution for this is use rendering element outside of CKEditor DOM and place it to right place by using absolute position. Alternative solution could be using iframe, but then typesetting engine's scripts and styles have to copy to child document.

Development

Contributions, improvements and bug fixes are welcome. To aid in this, try out our developer environment w/ live reload support and CKEditor 5 inspector.

Development environment

To enter a development loop with hot reload support:

  • git clone https://github.com/isaul32/ckeditor5-math.git
  • cd ckeditor5-math
  • yarn
  • yarn start
  • http://localhost:8080
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].