# Render your first Markdown template

Build a short release note from a Markdown template and a data object. You insert the version and status as text, add a trusted Markdown list, and get back a Markdown string to print or pass to an Agent.

You need Node.js 24.15 or newer and pnpm. Set `"type": "module"` in `package.json` so Node.js reads `import` and `export`. You do not need a Vite server, account, or network access.

::tutorial-step{title="Install the package"}
## Install the package

```bash [commands/install]
pnpm add @vite-hub/markdown-template
```

The renderer takes a full template string and a `data` object. It escapes scalar values as Markdown text.
::

::tutorial-step{title="Render a document"}
## Render a document

Create `server/render-release.ts`. Double braces insert scalar values as escaped text. `:insert` keeps the Markdown list as is, so pass it only a fragment that your app has checked and trusts.

```ts [server/render-release.ts]
import { renderMarkdownTemplate } from "vite-hub/markdown-template";

const markdown = await renderMarkdownTemplate(
  [
    "# Release {{ data.version }}",
    "",
    "Status: {{ data.status }}",
    "",
    ":insert{:markdown=\"data.notes\"}",
  ].join("\n"),
  {
    data: {
      version: "0.0.4",
      status: "ready",
      notes: "- Build passes\n- Preview checked",
    },
  },
);

console.log(markdown);
```

::

::tutorial-step{title="Run and check the result"}
## Run and check the result

Run the script with Node.js 24.15 or newer:

```sh [commands/verify]
node server/render-release.ts
```

It prints the rendered Markdown:

```md [output/result.md]
# Release 0.0.4

Status: ready

- Build passes
- Preview checked
```

To keep a template in its own file, import a `*.template.md` file. In a framework app, `vitehub()` loads it automatically. In a modular Vite config, add `hubMarkdownTemplate()` from `@vite-hub/markdown-template/vite`.

Next, read [Markdown templates](https://vitehub.dev/docs/markdown-template) for conditions, file imports, and migration. [Agent Instructions](https://vitehub.dev/docs/agents/instructions) shows how to use rendered Markdown as lasting Agent guidance.
::

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/markdown-template.md)
- [Get started](https://vitehub.dev/raw/docs/markdown-template/get-started.md) (this page)

Next: [MARKDOWN_TEMPLATE_R0012](https://vitehub.dev/raw/docs/markdown-template/diagnostics/markdown_template_r0012.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
