EditorMaker

A CodeMirror 6 editor factory with a scholarly aesthetic, supporting JavaScript, HTML, CSS, Markdown, and LaTeX.

JavaScript Editor

JavaScript

HTML Editor

HTML

CSS Editor

CSS

Markdown Editor

Markdown

LaTeX Editor

LaTeX
Line wrapping is enabled by default. Long lines will wrap rather than scroll horizontally, which is especially useful for prose in Markdown and LaTeX documents.

Usage

Include the bundle and create editors:

<script src="dist/editorMaker.bundle.min.js"></script>
<script>
  // Using the unified API
  const editor = EditorMaker.createEditor("#container", "javascript", {
    theme: "scholarly",      // or "solarizedLight", "dracula", etc.
    lineWrapping: true,      // default: true
    tabSize: 4,              // default: 4
    doc: "// initial code",  // optional initial content
    placeholder: "Type..."   // optional placeholder
  });
  
  // Or use convenience functions
  const jsEditor = EditorMaker.createJSEditor("#js");
  const htmlEditor = EditorMaker.createHTMLEditor("#html");
  const cssEditor = EditorMaker.createCSSEditor("#css");
  const mdEditor = EditorMaker.createMarkdownEditor("#md");
  const latexEditor = EditorMaker.createLaTeXEditor("#latex");
</script>

Editor Methods

// Get content
const code = editor.getContent();

// Set content
editor.setContent("new code here");

// Insert at cursor
editor.insert("inserted text");

// Get selection
const selected = editor.getSelection();

// Replace selection
editor.replaceSelection("replacement");

// Focus the editor
editor.focusEditor();

Build Commands

# Install dependencies
npm install

# Build all bundles
npm run build
# or
make build

# Watch mode for development  
npm run dev

# Serve with browser-sync
make serve

# Build and serve
make dev