0.8.3 • Published 3 months ago

@joggr/tempo v0.8.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Overview

Library used to programmatically build markdown documents, with a heavy tilt toward 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 '@joggrdocs/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('.', { append: true })
      .build()
  )
  .h2((txt) => 
    txt 
      .plainText('A')
      .italic('table')
  )
  .table([
    ['name', 'email'],
    ['Zac', 'zac@acmecorp.com']
  ])
  .toString();

fs.writeFile('myFile.md', result)
  .then(() => {
    console.log('DONE');
  });

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 '@joggrdocs/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('.', { append: true })
      .build()
  )
  .toJSON();

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

Credits

0.8.1

3 months ago

0.8.0

3 months ago

0.8.3

3 months ago

0.8.2

3 months ago

0.7.0

3 months ago

0.5.0

3 months ago

0.6.0

3 months ago

0.4.2

5 months ago

0.4.1

8 months ago

0.4.0

9 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.0

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago