Skip to main content

Logotype of the name of this project: Macromania

Text generation made easy simple.

<Definition id="tree" title="Tree">
  A <Def>tree</Def> is a connected graph on <Tex>n</Tex> vertices
  with <Tex>n - 1</Tex> edges<Cite id="Diestel2016" />.
</Definition>

Macromania is a typescript-embedded domain-specific language for creating strings, using jsx syntax. You can think of it as a highly expressive but completely unopinionated templating language. It takes inspiration from lisp-like macro expansion and TeX, but the design ensures meaningful error reporting, principled interaction between stateful macros, and static typing for the input expressions.

To learn how to use it, read the tutorial. To learn how it works, read the source.

Macromania is not a UI library, nor concerned with interactivity. It produces static text.

JSX Configuration

To use jsx syntax for Macromania, you need to configure your typescript compiler (here an example for deno):

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Deno",

  "imports": {
    "macromaniajsx/jsx-dev-runtime": "https://deno.land/x/macromania@v0.1.0/mod.ts",
    "macromaniajsx/jsx-runtime": "https://deno.land/x/macromania@v0.1.0/mod.ts"
  },

  "compilerOptions": {
    "jsx": "react-jsxdev",
    "jsxImportSource": "macromaniajsx",
  }
}

Some text editors might require such configuration not only in the modules that use Macromania, but also in the editor’s workspace directory.