What is TemplateDX?
TemplateDX is a declarative, extensible, and composable templating engine built on Markdown and JSX, developed by AgentMark for building with large language models. TemplateDX looks a lot like MDX, 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:
Note: TemplateDX supports a superset of CommonMark, but the parser does not enable GitHub-flavored Markdown extensions. It usesTheremarkParse + remarkMdx + remarkFrontmatter, notremark-gfm. GFM-only features (strikethrough, task lists, and GFM tables with cell alignment, like the one above) are parsed as plain text, not as structured AST nodes.
<If> tag, {props.isAwesome} expression, component imports, and frontmatter are all evaluated by TemplateDX at transform() time. See Syntax for the full list of primitives.
Language support
- TypeScript / JavaScript: full
parse/transform/stringifypipeline via@agentmark-ai/templatedx. - Python:
transformviaagentmark-templatedx. Python consumes ASTs produced by the TS parser, so parsing andstringifyare TS-only.
stringify step is pluggable in principle, so emitting HTML or other formats is a reasonable extension. PRs welcome at github.com/agentmark-ai/agentmark.