@samva/markup
v0.1.2
Published
Type-safe authoring and compilation primitives for Samva templates
Maintainers
Readme
@samva/markup
Type-safe authoring and compilation primitives for Samva email, SMS, and WhatsApp templates. Use it
directly for TSX templates or together with @samva/vite for the visual editor and project build.
Install
npm install --save-dev @samva/markup @samva/vite viteConfigure TypeScript to use the Samva JSX runtime:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@samva/markup"
}
}Then author a default-exported template:
import { Email, Heading, Text } from "@samva/markup/components";
import type { Variables } from "@samva/markup/variables";
export default function Welcome(v: Variables<{ firstName: string }>) {
return (
<Email>
<Heading level={1}>Welcome, {v.firstName}</Heading>
<Text>Thanks for joining Samva.</Text>
</Email>
);
}The public subpaths also expose the SML parser, printer, compiler, diagnostics, variables, theme primitives, channel compilers, and gallery preset data. Prefer the highest-level entrypoint that matches the task instead of depending on implementation files.
