1.6.1 β€’ Published 3 months ago

diagonjs v1.6.1

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

npm version npm downloads CI status codecov TypeScript

Craft captivating ASCII art from your Markdown expression with ease, powered by Diagon.

πŸš€ Features

  • Supports Math, Sequence, Tree, Table, Grammars, Frame, and GraphDAG expressions.
  • Flexible translation with customizable options including styles like Unicode, ASCII, Latex, and more.
  • Support for both Node.js and browser environments.
  • Compatible with CommonJS (CJS) and ECMAScript Module (ESM) environments.
  • Fully typed for enhanced developer experience.

βš™οΈ Install

Install it locally in your project folder:

npm i diagonjs
# Or Yarn
yarn add diagonjs
# Or pnpm
pnpm add diagonjs

πŸ“– Usage

Initialize diagonjs

To initialize diagon.js in your application:

import Diagon from "diagonjs";

const diagon = await Diagon.init();

Use a translator

Once Diagon.js is initialized, you can use its translators to interpret and transform expressions.

Below is an example using the math expression translator:

diagon.translate.math("f(x) = 1 + x / (1 + x)", { style: "Unicode" });

//               x
// f(x) = 1 + ─────
//            1 + x

And here's an example employing the sequence diagram translator:

diagon.translate.sequence(
  "Alice -> Bob: Hello Bob!\nAlice <- Bob: Hello Alice!",
  { asciiOnly: false },
);

// β”Œβ”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”
// β”‚Aliceβ”‚       β”‚Bobβ”‚
// β””β”€β”€β”¬β”€β”€β”˜       β””β”€β”¬β”€β”˜
//    β”‚            β”‚
//    β”‚ Hello Bob! β”‚
//    │───────────>β”‚
//    β”‚            β”‚
//    β”‚Hello Alice!β”‚
//    β”‚<───────────│
// β”Œβ”€β”€β”΄β”€β”€β”       β”Œβ”€β”΄β”€β”
// β”‚Aliceβ”‚       β”‚Bobβ”‚
// β””β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”˜

πŸ“š Documentation

  • Dive deeper into the source code by exploring the translators
  • Find practical integrations with express, react and more in the examples section.
  • Explore the test section in the Diagon C++ repository. It contains input and output samples.
  • Experience Diagonjs in action using the online interpreter.

πŸ’– Thanks

This project has been possible thanks to these great projects:

License

This project is licensed under the MIT License.

1.6.1

3 months ago

1.6.0

3 months ago

1.5.2

3 months ago

1.5.1

3 months ago

1.5.0

3 months ago

1.4.0

3 months ago

1.3.0

3 months ago

1.2.0

3 months ago

1.1.3

3 months ago

1.1.2

3 months ago

1.1.1

3 months ago

1.1.0

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago