TEI Author View

A tag-free, word-processor-like view of TEI and other XML files for VS Code and VSCodium. The document is rendered with CSS: verses as verses, headings as headings, <caesura/>, page breaks and footnote anchors as small labels. You type in the text as in a word processor. The tags cannot be damaged, and the XML file keeps its own indentation and line breaks.

It works on its own, and alongside TEI Scholar.

Version 0.1.3, 29 November 2026. Specified by Dominik Wujastyk; the program was vibe-coded by Claude Opus 5.5 (Anthropic).

The XML source (left) and the same verses in the Author view (right)

Left: the XML source of Suśrutasaṃhitā 4.17.35–40. Right: the same verses in the Author view.

Install

VSCodium: in the Extensions view, search for TEI Author View and click Install. It comes from Open VSX, and VSCodium updates it automatically when a new version is published.

By hand (or in VS Code): download the latest tei-author-view-X.Y.Z.vsix from Releases, then Extensions view → ⋯ menu → Install from VSIX… → choose the file. A copy installed this way is not updated automatically.

Use

Action Windows / Linux Mac
Open the Author view beside the XML Ctrl+Alt+A, or the preview button at the top right of the XML tab ⌘⌥A
Back to the XML at the same spot Ctrl+Alt+A in the Author view, or XML ⌘⌥A
Open in place of the XML right-click the tab → Reopen Editor With… → TEI Author View  

Styling with your own CSS

The built-in stylesheet (media/tei-default.css) covers common TEI. Add your own CSS files after it, in either of two ways:

  1. Setting teiAuthor.stylesheets, e.g. ["~/tei/susruta.css"] (relative paths are taken from the XML file’s folder).
  2. In the document: <?xml-stylesheet type="text/css" href="susruta.css"?>

Selectors are the XML element and attribute names:

lg { margin: 1em 0; }
l:nth-child(2) { padding-left: 2em; }          /* indent the second pāda line */
trailer { display: none; }                       /* hide the concordance notes */
div[type="adhyaya"] > head { text-align: center; }
caesura::before { content: " ‖ "; background: none; }
seg[type="commentary"] { font-size: .9em; color: #555; }

attr() works, e.g. pb::before { content: "[" attr(n) "]"; }. For xml:id write [xml\:id] / attr(xml\:id). oXygenxml stylesheets can be reused in part: plain CSS works, oXygenxml’s own oxy_… functions do not. After editing a stylesheet, press the ↻ button to reload it.

Settings for the font (teiAuthor.fontFamily, fontSize, lineHeight), the click pop-up, cursor sync, and which empty elements are typeable are under Settings → Extensions → TEI Author View.

How it works

The extension parses the XML with a small error-tolerant parser that records the character position of every element and every run of text. The view is built from that tree, with each XML element shown as an element of the same name, so ordinary CSS applies. Each keystroke becomes a small change at a known position in the file, checked against the current text before it is applied. If the check fails (e.g. the file was changed elsewhere), the view is redrawn from the file. So the XML is never re-serialised, and the view can never write markup.

Development

npm install
npm test                         # parser and edit-mapping tests
PW=<path to playwright> npx tsx test/view.e2e.ts   # typing tests in Chrome
xvfb-run node test/integration/run.js              # opens the view in real VS Code
npm run package                  # → tei-author-view-X.Y.Z.vsix (not committed)

Releasing a new version: raise version in package.json, update CHANGELOG.md, commit and push, then publish a GitHub release with the tag vX.Y.Z. The Release workflow builds and tests the extension, attaches the .vsix to the release and publishes it on Open VSX (it needs the repository secret OVSX_PAT, an Open VSX access token).

Credits

Specified by Dominik Wujastyk (University of Alberta), 28 November 2026, for transcription work on the Suśruta Project. The code was vibe-coded by Claude Opus 5.5 (Anthropic) to that specification.

Licence

MIT