Tortellini is a minimal code editor written in TypeScript.
- Syntax highlighting
- Code completion
import { Tortellini } from "tortellini";
// https://unpkg.com/tortellini/index.js
const editor = new Tortellini(
document.querySelector("[data-editor]"),
"javascript"
);
// new Tortellini(element, language, options);
// ^
const options = {
// Default
caretColor: "#fff", // Provide a CSS color data type value
indentionSize: 4
}
- JavaScript
javascript
- HTML
html
(Experimental) - CSS
css
const editor = new Tortellini(/* ... */);
editor.code // Get the written code
editor.remove(); // Reset the base element