editor

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package editor ships a small, dependency-free code editor for glaze WebViews: line numbers, syntax highlighting, autocompletion, error marks and bracket matching, in plain embedded HTML/CSS/JS — no CDN, no framework, nothing fetched at runtime, so a single-binary app stays a single binary.

The page side is one JS class, GlazeEditor (see editor.js for its API), plus pluggable language definitions; Filo and SQL ship in lang/. The Go side only hands the app the assets to serve or inline:

js, _ := editor.JS("filo")             // core + the filo definition
css := editor.CSS()
mux.Handle("/editor.js", ...)          // or inline in the page

An app then instantiates it from its own page:

<div id="ed" style="height: 20em"></div>
<script>
  const ed = new GlazeEditor(document.getElementById("ed"),
    {language: "filo", completions: ["self-x", "seek"]});
</script>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSS

func CSS() []byte

CSS is the editor's stylesheet. Theme it by overriding the CSS variables declared on .ge (see editor.css).

func JS

func JS(langs ...string) ([]byte, error)

JS returns the editor core followed by the requested language definitions, ready to serve or inline as one script. Asking for no languages is valid — an app can register its own on the page — and asking for one that does not exist is an error rather than a silently colorless editor.

func Languages

func Languages() []string

Languages lists the language definitions shipped in this package.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL