> ## Documentation Index
> Fetch the complete documentation index at: https://puzzlet-9ba7bb98.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> TemplateDX is an extensible templating engine for AI prompts, built on Markdown and JSX.

## What's TemplateDX?

TemplateDX is a declarative, extensible, and composable templating engine built on Markdown and JSX, developed by [AgentMark](https://github.com/agentmark-ai/agentmark) for building with large language models.

TemplateDX looks a lot like [MDX](https://mdxjs.com), but the runtime is purpose-built for prompts. It adds its own tag plugins (`<If>`, `<ElseIf>`, `<Else>`, `<ForEach>`, `<Raw>`), a filter registry for expression evaluation, and a bundler that inlines imported components at bundle time. MDX is a **document format** that compiles to JSX; TemplateDX is a **prompt-rendering engine** that shares the surface syntax but parses to an AST, evaluates expressions and tag plugins against a `props` object, and serializes back to Markdown. MDX targets JSX runtimes; TemplateDX targets LLM prompts.

## Why extend Markdown?

TemplateDX extends Markdown's familiar syntax to support complex, structured content. Markdown works well for basic content but lacks the flexibility needed for templating, composable components, and organized content. TemplateDX adds custom components and templating primitives, enabling document composability, conditional rendering, and variable interpolation while preserving Markdown's readability.

## What does it look like?

A TemplateDX file is a `.mdx` document that combines Markdown, frontmatter, imports, JSX components, and tags:

```jsx theme={null}
---
name: Markdown with JSX and Frontmatter
author: Ryan
---

import SomeMarkdownComponent from './my-md-component.md';
import SomeMDXComponent from './my-mdx-component.mdx';

# Hello World

> TemplateDX uses Markdown to make it readable.

## Table

| Item              | In stock | Price |
| :---------------- | :------: | ----: |
| Python Hat        |   True   | 23.99 |
| SQL Hat           |   True   | 23.99 |
| Codecademy Tee    |  False   | 19.99 |
| Codecademy Hoodie |  False   | 42.99 |

## Components

<SomeMarkdownComponent />

<SomeMDXComponent title="Demo" />

## Tags

<If condition={props.isAwesome}>
  **TemplateDX is awesome!**
</If>
```

> Note: TemplateDX supports a superset of CommonMark, but the parser **doesn't** enable GitHub-flavored Markdown extensions. It uses `remarkParse + remarkMdx + remarkFrontmatter`, not `remark-gfm`. The parser treats GFM-only features (strikethrough, task lists, and GFM tables with cell alignment, like the one above) as plain text, not as structured AST nodes.

TemplateDX handles each piece at a different stage: it evaluates the `<If>` tag and `{props.isAwesome}` expression at `transform()` time, inlines component imports at bundle time, and parses frontmatter and exposes it via `getFrontMatter` (it passes through to the output untouched). See [Syntax](/templatedx/syntax) for the full list of primitives.

## Language support

* **TypeScript / JavaScript**: full `parse` / `transform` / `stringify` pipeline via `@agentmark-ai/templatedx`.
* **Python**: `transform` via `agentmark-templatedx`. Python consumes ASTs produced by the TS parser, so parsing and `stringify` are TS-only.

Output is Markdown today. The `stringify` step is pluggable in principle, so emitting HTML or other formats is a reasonable extension. PRs welcome at [github.com/agentmark-ai/agentmark](https://github.com/agentmark-ai/agentmark).

## Next steps

Install the package and render your first template in the [Quickstart](/templatedx/quickstart).
