Skip to main content

Adding Languages

Criteria for a new language

  • Has a syntax that needs to be compiled/transpiled to work in browsers (e.g. not a JS library).
  • A compiler/runtime that runs client-side in the browser (not on a remote server).
  • Its output can be represented in a web page.
  • Relatively popular (e.g. at least hundreds of GitHub stars/thousands of weekly downloads).
  • Not esoteric (otherwise, convince me if you have a good use case).
  • The compiler/runtime is still reasonably maintained.
  • The compiler/runtime has a permissive license compatible with MIT license.

If you still have doubts if the language qualifies, let's discuss it.

Checklist when adding

flowchart TD
A[Add Language] --> B["Create language specs<br/>src/livecodes/languages/"]
B --> C["Add to languages.ts<br/>or processors.ts"]

C --> D{"Compiler needs<br/>separate build?"}
D -->|Yes| E["Add to build script<br/>scripts/build.js"]
D -->|No| F{"New packages/<br/>static files?"}

F -->|Yes| G["Add to browser-compilers repo<br/>and CDN"]
F -->|No| H["Reference vendors.ts<br/>for CDN links"]

E --> H
G --> H

H --> I["Add name/aliases<br/>to sdk/models.ts"]
I --> J["Add editor support<br/>Monaco/CodeMirror/Prismjs"]
J --> K["Add language info<br/>html/language-info.html"]
K --> L{"Starter template?"}

L -->|Yes| M["Create template<br/>Add to TemplateList, command-menu,<br/>language-info"]
L -->|No| N["Add e2e tests"]

M --> N
N --> O["Add language docs<br/>docs/docs/languages/"]
O --> P["Add to docs slider<br/>LanguageSliders.tsx"]
P --> Q["Add licenses<br/>vendor-licenses.mdx"]
Q --> R["Update badge<br/>README.mdx"]