PACKAGES

Published packages and verification scope.

This website's page bodies are Matra templates composed with page data, evaluated by @matra/core, generated across routes by @matra/site-generation, and rendered as HTML by @matra/html. The @matra/cli creates, builds, and previews starter projects. The examples below include provisional APIs; check each package's version and release notes.

Examples use Core 0.3.1-site.4, HTML 0.3.1-site.0, CLI 0.3.2-alpha.3, and site-generation 0.1.0-site.5; compatibility and APIs are provisional.

Verification target

Dependencies used by the website build

Review each package's role and a minimal usage example.

The left panel shows the complete Markdown source. matra.entry selects main.matra, and matra.values exposes the JavaScript expression as content. @matra/core evaluates the document, while @matra/site-generation builds a site from pages, shared layouts, and data. The CLI creates and builds starter projects. The code below shows each package in use.

MARKDOWNexample.md
---
matra:
  entry: main.matra
  values:
    - content.js.part
---

# Compose a page with Matra packages

```main.matra
html(lang="en") {
  head {
    title { content.pageTitle(content.title) }
  }
  body {
    header {
      p { "MATRA / PACKAGE EXAMPLES" }
      h1 { content.title }
      p { content.description }
    }
    main {
      ...for (item in content.packages) {
        section(id=item.id) {
          h2 { item.name }
          p { item.description }
          pre { code { item.example } }
        }
      }
    }
    footer {
      p { "These package workflows are experimental; check each package's release notes." }
    }
  }
}
```

```content.js.part
({
  title: "Compose a page with Matra packages",
  description: "Use the CLI to start a project, Core to evaluate Matra documents, and site-generation to build a site.",
  pageTitle: title => `${title} | Matra`,
  packages: [
    {
      id: "cli",
      name: "@matra/cli",
      description: "Create and preview a starter project with the experimental CLI.",
      example: "npm install --global @matra/[email protected]\nmatra init hello\ncd hello && matra dev"
    },
    {
      id: "core",
      name: "@matra/core",
      description: "Build and run a literate Matra document in Node.js.",
      example: 'const value = await runLiterate(await buildLiterate(source))'
    },
    {
      id: "site-generation",
      name: "@matra/site-generation",
      description: "Generate pages from Matra templates, page data, and a shared layout.",
      example: 'await generateSite({ root, output: "dist", pages })'
    }
  ]
})
```
HTMLgenerated output
<html lang="en">
  <head>
    <title>Compose a page with Matra packages | Matra</title>
  </head>
  <body>
    <header>
      <p>MATRA / PACKAGE EXAMPLES</p>
      <h1>Compose a page with Matra packages</h1>
      <p>Use the CLI to start a project, Core to evaluate Matra documents, and site-generation to build a site.</p>
    </header>
    <main>
      <section id="cli">
        <h2>@matra/cli</h2>
        <p>Create and preview a starter project with the experimental CLI.</p>
        <pre><code>npm install --global @matra/[email protected]
matra init hello
cd hello &amp;&amp; matra dev</code></pre>
      </section>
      <section id="core">
        <h2>@matra/core</h2>
        <p>Build and run a literate Matra document in Node.js.</p>
        <pre><code>const value = await runLiterate(await buildLiterate(source))</code></pre>
      </section>
      <section id="site-generation">
        <h2>@matra/site-generation</h2>
        <p>Generate pages from Matra templates, page data, and a shared layout.</p>
        <pre><code>await generateSite({ root, output: &quot;dist&quot;, pages })</code></pre>
      </section>
    </main>
    <footer>
      <p>These package workflows are experimental; check each package&#39;s release notes.</p>
    </footer>
  </body>
</html>

Packages

Check role and publication status separately.

01

@matra/core

Provides grammar, evaluation, document AST, browser APIs, and the experimental literate API. This site uses the literate API to evaluate Matra documents.

const value = await runLiterate(await buildLiterate(source))
Core source →

02

@matra/cli

An experimental CLI for creating, building, and locally previewing starter projects.

npm install --global @matra/[email protected]
matra init hello
cd hello && matra dev
npm package →

03

@matra/site-generation

Generates a site from Matra templates, shared layouts, and page data. This package generates every route on this website. Its API and version are provisional.

await generateSite({ root, output: "dist", pages })
Site generation source →

04

@matra/html

Renders document AST to HTML with text/attribute escaping and base-path support. This website uses it through site-generation.

const html = toHTML(documentAST)
HTML source →

05

Other domain packages

Graphics, Math, and Compute Engine have separate verification scopes; publication and completeness are assessed separately.

Priorities and scope →

Environment

The literate API targets Node.js 22/24.

The bundled compiler means Rust, a checkout, and an additional download are not required at runtime. The API is experimental; run only trusted input.

Public distribution contract