A world-class math input for the web
at main 59 lines 3.3 kB view raw view rendered
1# Caret 2 3Caret is a world-class math input for the web. 4 5> [!WARNING] 6> **Caret is not ready for public use/contributions.** Caret is not yet usable. Everything can and will change. Do not rely on it. I am not accepting contributions or PRs right now. It is just published so you can poke around if you're curious. 7> 8> The README information below is written in the present tense, but most of it is not yet true. This document demonstrates my aspirations, not what actually exists! 9 10## Features 11 12- **Parsing.** Caret has built-in support for parsing user input into an easily-consumable tree. This makes it easy to analyze and perform computation on user input. 13- **Syntax Highlighting.** Define your own custom syntax highlighting. Create custom rules that use the parsed tree to customize rendering. 14- **Live Multiplayer.** Use Caret's built-in CRDT to effortlessly support live multiplayer editing, with or without a central server. 15 16- **Any Frontend Library.** Caret can be integrated with any frontend library or used with plain JavaScript. 17- **Custom Rendering.** Provide your own components to customize rendering of all token types. 18- **World-Class Accessibility.** Caret has native support for keyboard navigation, screen reader output, speech input, braille displays, and more. 19 20- **LaTeX Input/Output.** Caret can instantly input and output LaTeX for interoperability with other tools. 21- **MathQuill Compatibility.** Coming from MathQuill? The MathQuill compatibility layer makes Caret a drop-in replacement. 22- **Customize Everything.** Absolutely everything in Caret is modular and customizable. Define your own token types, customizing parsing behavior, and more. 23 24## Alternatives to Caret 25 26Caret is not the only library that allows users to type math on the web. Here are some possible alternatives. 27 28### MathQuill 29 30[MathQuill](http://mathquill.com/) is a robust, battle-tested library for typing math on the web. Desmos uses a [modified version](https://github.com/desmosinc/mathquill) of MathQuill, which also means it is used by the College Board on the SAT. 31 32**Key Points:** 33 34- ✅ User experience is excellent 35- ✅ Extremely battle-tested 36- ⛔️ Poor developer experience (jQuery-based, bad fit for modern ecosystem) 37- ⛔️ Few customization options (not plugin-based, limited to a limited few settings) 38 39### MathLive `<math-field>` 40 41The [MathLive `<math-field>`](https://mathlive.io/mathfield/) is an open-source web component that allows typing math. 42 43On paper, MathLive does many things right. But in practice I find that it has many little papercuts that make it slightly unpleasant as both a user and a developer. 44 45- Reasonable user experience 46- Extreme dedication to LaTeX compatibility 47- Built-in virtual keyboard 48- Wide scope (does many things with lots of configuration options) 49 50### Katex (LaTeX rendering only) 51 52If your only goal is to render static LaTeX math (not allow typing), you should almost certainly use [Katex](https://katex.org/). It's a gold-standard, time-tested tool that does one thing extremely well. 53 54- ✅ Renders to static HTML and CSS on the server or the client 55- ✅ Accessible rendering 56- ✅ Extremely fast 57- ✅ Supports a very large subset of LaTeX 58- ✅ Simple, friendly developer experience 59- ⛔️ No user input (rendering only)