
Programmatic Markdown
Create markdown on the fly using a simple, intuitive API (with Types)
A set of TypeScript libraries for building markdown.
import tempo from '@joggr/tempo';
/**
* This is a simple example of using tempo to generate markdown.
*/
export default tempo()
.h1('Hello, World!')
.p('This is a paragraph.')
.code('console.log("Hello, World!")')
.toString();
import tempo from '@joggr/tempo';
/**
* This is a simple example of using tempo to generate markdown as a function (template).
*/
export function createDocument(payload: {
title: string,
description: string,
example?: string
}) {
const doc = tempo()
.h1(payload.title)
.p(payload.description);
if (payload.example) {
doc.code(payload.example);
}
return doc.toString();
}