🏁 Monza Editor 🏎️

GitHub Action npm License

The textarea element with syntax highlight.

Its core library consists of only 1 KB JavaScript and 0.5 KB CSS.

Install

# For Preact
npm install @monza-editor/preact

# For React
npm install @monza-editor/react

# For Solid.js
npm install @monza-editor/solid

# For vanilla JS
npm install monza-editor

Usage

Syntax highlighting

Instead of providing the default syntax highlighter, Monza Editor lets you bring one of your own. You need to pass a highlight function which takes source code as a string and returns HTML-annotated code as a string on the initialization of Monza Editor. See examples and their source code for more details.

CSS styling

At the very minimum, we recommend you to set font-size and font-family to a certain monospace font at the top-level element. You might set the other CSS properties, such as line-height, background and border, there.

You might also set the following CSS variables that overwrite their corresponding CSS properties.

Alternatives

License

MIT

Examples

Astro

Preact

React

Solid.js

Vanilla JS