tempo

所属分类:代码编辑器
开发工具:TypeScript
文件大小:0KB
下载次数:0
上传日期:2023-08-14 23:25:32
上 传 者sh-1993
说明:  以编程方式创建降价文档。,
(Programmatically create Markdown documents.,)

文件列表:
.eslintignore (171, 2023-12-22)
.eslintrc.js (421, 2023-12-22)
.prettierignore (30, 2023-12-22)
.prettierrc.json (152, 2023-12-22)
.vscode/ (0, 2023-12-22)
.vscode/settings.json (873, 2023-12-22)
LICENSE (1062, 2023-12-22)
examples/ (0, 2023-12-22)
examples/docs/ (0, 2023-12-22)
examples/docs/basic.md (286, 2023-12-22)
examples/docs/code.md (228, 2023-12-22)
examples/docs/table.md (189, 2023-12-22)
examples/index.ts (1031, 2023-12-22)
examples/lib/ (0, 2023-12-22)
examples/lib/basic.ts (649, 2023-12-22)
examples/lib/code.ts (537, 2023-12-22)
examples/lib/table.ts (358, 2023-12-22)
jest.config.ts (611, 2023-12-22)
logo.png (52095, 2023-12-22)
package-lock.json (305288, 2023-12-22)
package.json (1194, 2023-12-22)
src/ (0, 2023-12-22)
src/index.ts (277, 2023-12-22)
src/lib/ (0, 2023-12-22)
src/lib/Document.ts (8786, 2023-12-22)
src/lib/Text.ts (3563, 2023-12-22)
src/lib/__tests__/ (0, 2023-12-22)
src/lib/__tests__/Document.test.ts (11355, 2023-12-22)
src/lib/__tests__/Text.test.ts (3409, 2023-12-22)
... ...


"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

npm version CodeQL Publish to npm CI
JS Semi-standard Style Prettier Style

## Overview Library used to programmatically build markdown documents, with a heavy tilt toward [GitHub Flavored Markdown (GFM)](https://github.github.com/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** ```shell npm install @joggr/tempo ``` **yarn** ```shell yarn add @joggr/tempo ``` ## Usage ```typescript 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. ```typescript 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 - Logo by [Time management icons created by Freepik - Flaticon](https://www.flaticon.com/free-icons/time-management)

近期下载者

相关文件


收藏者