Skip to content

tempoProgrammatically build markdown.

A set of TypeScript libraries for building markdown.

VitePress

Usage

ts
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();
ts
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();
}