stilo

Editor design

The editing model and architecture of the editor. Status: draft, 2026-10-18. Items marked (open) are still to be decided here.

Who it is for

Engineers, finance people and other knowledge workers who do their work in Word and Excel, not programmers. The editor must be as approachable as Word and Excel. Writing raw Texl with <% %> tags stays possible for power users, but nobody has to.

Editing model: a stack of cells

A document is a vertical stack of cells, the way an Excel sheet is a grid of cells. It looks like lined paper: each line is a cell, ruled below by a soft gray line (--texl-line), at least one line high and taller when its content needs it.

Revisions, releases and permissions belong to Papiro (the platform), not to Stilo. Comments are stored in the document (see above); how they are shown, and any structure they have, is up to the platform.

Cell types

Type Edit mode Status
text Texl template shown as HTML; Swan highlighted in <% %> tags, Mod+E inserts one Boilerplate
markdown text with Markdown: highlighted in the editor, turned into HTML for display Boilerplate
table A grid where each table cell’s Texl source is edited in its own field; shown as the rendered table Ready for the MVP (2026-10-31): a Markdown pipe table (O5) edited as a grid of fields
formula One tag, edited as its expression without the <% %>, shown as its output First version
data “Data table”: a table of values (stilo.dataframe), edited as a name and a grid of Swan expressions, shown as the table the library renders First version (2026-11-09); replaces the dropped spreadsheet idea
chart “Chart”: a chart drawn by the Stilo library (stilo.charts.line), edited as a form: chart type, X and Y values (formulas giving lists), axis labels and title (plain text) First version (2026-11-10)
figure A parametric figure Idea
ai A prompt from which AI writes the cell’s Texl Idea
rich WYSIWYG, with a toolbar; formulas as chips that show their value (see Rich text below) Default type of new cells; first version

Other formats for raw templates (e.g. LaTeX) are possible later as cell types built on text, as markdown is.

Formulas are <% %> tags inside a text or markdown cell, inserted with Mod+E, as fields in Word (parent D11). A cell that is one tag and nothing else can also be a formula cell (2026-10-30): its source stays that plain tag, edited without the delimiters. The reasons D11 dropped the older expression cell are answered by the shape rule (see Editing model): the type is offered only for a source that is one tag, and an expression containing %>, which would split the tag, is not committed. Files with <!--% expression %--> still open, as text with their type kept, like any unknown type.

Rich text

Decided 2026-11-07 (S9). The rich cell is what a Word user expects: bold is bold, a title is a title. It shows its output as a markdown cell does, and in edit mode a ProseMirror editor takes CodeMirror’s place, with the same typography.

Typography

The rendered document reads like a well-set engineering report (2026-11-09, chosen among five fonts, three table and three caption styles, after an engineering report set in Verdana; it replaces the Literata choice of 2026-10-30): Atkinson Hyperlegible Next for text, headings and table headers alike, a wide, open sans with a large x-height like Verdana and unambiguous shapes (1 l I, 0 O), at 15.5 px with line height 1.6. Paragraphs and list items are justified, with automatic hyphenation where the browser has it for the page’s language. Tables span the full width less a small margin on each side (--texl-table-inset, 1em), columns sized by their content; they are ruled as in print (a strong rule above and below, a thin one under the header, hairlines between rows) with tabular figures, so numbers line up. A table’s caption is an HTML <caption> element, with no Markdown syntax of its own: written on its own line right after a Markdown table (or right before it), it is moved into the table when the cell renders (captionTables in markdown-cell.js; the HTML parser would otherwise drop it). It shows below the table, left-aligned with it, in the text colour. For now only markdown cells accept such a source: table and rich cells refuse it. Sub- and superscripts do not open up the line. Equations are set at 1.08 times the text size (--texl-math-size), not KaTeX’s 1.21: the text font’s x-height is larger than KaTeX’s, so its letters and digits stay close to the text’s. The styles are the cells’ (.view in TexlCell), so every cell type shares them; a host changes the fonts with --texl-font, --texl-heading-font (defaults to --texl-font) and --texl-font-size, and loads the font files itself (Stilo bundles them, so it works offline). Edit mode keeps the monospace font (--texl-mono).

File format

A document is still one Texl text file. Each cell starts with a marker line, an HTML comment that the editor recognises:

<!--{ bek4 : markdown }-->
# Beam check
<% L = 6, q = 12.5 %>
<!--{ mom3 : markdown }-->
<% q * L ^ 2 / 8 %>
<!--[ Anna: check the load combination. ]-->

Rendering

After every committed edit the editor renders the whole document, as the document at its URL (url), with one engine.render(url, source): exactly what any other Texl host renders, imports included. Imports resolve against the document URL and are fetched again on every rendering, so a changed library shows on the next one. The names of earlier cells are in scope, since Texl evaluates the document top to bottom in one scope.

The rendering is then split into the cells’ outputs at the places of the cells’ markers, which render to themselves (HTML comments without tags):

Architecture

Plain JavaScript (ES modules, JSDoc types) and Lit web components. The architecture page describes the modules in detail; this section keeps the outline.

<texl-editor>                     the app: document, navigation, rendering
  ├─ <texl-cell-text>             one element per cell, by type
  ├─ <texl-cell-markdown>
  └─ <texl-cell-…>                custom cells from third parties
        all extend TexlCell       base: modes, layout, commit protocol

Open points