@joggr/tempo
TypeScript icon, indicating that this package has built-in type declarations

0.13.4 • Public • Published


"Running gives freedom. When you run you can determine your own tempo. You can choose your own course and think whatever you want. Nobody tells you what to do." - Nina Kuscsik

Overview

A TypeScript package used to programmatically build markdown documents, with a heavy tilt toward GitHub Flavored Markdown (GFM).

  • 🦄 Programmatically generate docs for CI or commit-hooks
  • 📋 Create reusable templates for your projects
  • 🤖 Build templates for standardizing output from LLMs
  • 🐱 Use all the goodness of GitHub Flavored Markdown (GFM)

Getting Started

Install the library and you can begin to use it in your application(s).

This is a GitHub Package and your application must support installing internal GitHub packages before you can use this package.

npm

npm install @joggr/tempo

yarn

yarn add @joggr/tempo

Usage

import fs from 'node:fs/promises';
import tempo from '@joggr/tempo';

const result = tempo()
  .h1('Hello World')
  .paragraph('Some things')
  .paragraph((txt) => 
    txt
      .plainText('A sentence with')
      .bold('bolded words')
      .plainText('and')
      .italic('italicized words')
      .plainText('.')
      .build()
  )
  .h2((txt) => 
    txt 
      .plainText('A')
      .italic('table')
  )
  .table([
    ['name', 'email'],
    ['Zac', 'zac@acmecorp.com']
  ])
  .toString();

await fs.writeFile('myFile.md', result);

Serialized Data (⚠️ Unstable API ⚠️)

Tempo creates a syntax tree that can be serialized and stored in a data base.

import db from 'db/orm';
import tempo from '@joggr/tempo';

const result = tempo()
  .h1('Hello World')
  .paragraph('Some things')
  .paragraph((txt) => 
    txt
      .plainText('A sentence with')
      .bold('bolded words')
      .plainText('and')
      .italic('italicized words')
      .plainText('.')
      .build()
  )
  .toJSON();

// Example of storing a serializable data object to the DB
await db.collection('tempoDoc').findAndSave(1, result);

License

Licensed under MIT.



Want to sign up for Joggr?

We'd love to have you join, but we are in closed beta.
You can join our waitlist below.

Join the Waitlist

Readme

Keywords

none

Package Sidebar

Install

npm i @joggr/tempo

Weekly Downloads

401

Version

0.13.4

License

MIT

Unpacked Size

721 kB

Total Files

15

Last publish

Collaborators

  • zrosenbauer
  • danielbot