Scripta Developer Docs

The Scripta Project

Scripta is an editing and publishing system for technical documents (mathematics, physics, etc.). It consists of four components

  • Demo app . No login required. You can edit the text you see there or create something entirely new. Your edits will not be saved.
  • Scripta.io, a web app with a searchable store of documents. No login required to search for and read public documents.
  • Scripta Desktop, for Mac OS (fat binary), soon to be cross-compiled for Linux and Windows. A desktop version of Scripta.io.
  • The Scripta compiler. This is the engine which makes all of the above work.

The compiler and the applications are written in Elm, a pure functional language that compiles to Javascript. See the Tech Stack section below for more information.

Source code:

Screenshots

Scripta.io, a notebbook document

screenshot-editor-closed

Direct link

Scripta.io, an ordinary document

screenshot-editor-open

Direct link

Scripta Desktop

Scripta Desktop

Download page

Compiler

The Scripta compiler supports three markup languages

  • L0
  • MicroLaTeX
  • XMarkdown

L0 has a syntax inspired by Lisp; MicroLaTeX is an implementation of LaTeX, and XMarkdown is like Markdown, but with some extra features, e.g., TeX-style mathematical text.

See this live example for a simple demonstration of microLaTeX (source code here). You can edit the text of the example app at will. Scripta.io is a full-featured use case that makes use of the compiler's error recovery facilities and which implements synchronization of source and rendered text: click on rendered text to highlight and bring into view the corresponding source text; select a block of source text and press ctrl-S (for "sync") to highlight the corresponding rendered text and bring it into view.

The compiler is open-source, with the code hosted on Github) and with some documentation (work in progress). See also the example source code

Tech stack

Both the app and the compiler are written in Elm, a pure functional language that compiles to Javascript. The app also uses the Lamdera framework, which permits one to write both the front and the backend in Elm. See this short note on Lamdera. Mathematical text is rendered using KaTeX and the editor relies on Codemirror 6. The interface to Elm for both of these is via custom elements.

Scripta Desktop is built with Tauri.app. See this article for some notes on how it was assembled. Briefly, Tauri is a way of converting a web app built with most any language/framework including Elm into a desktop app. It has both good security and small asset size.

Note

Most of the rest of this document concerns the web app and is intended to help the app developers.