Home

Awesome

<p align="center"> <picture> <img src="https://i.ibb.co/nbMS51q/Group-1.png" height="128"> </picture> <h1 align="center">Diagonjs</h1> </p> <div align="center">

npm version npm downloads CI status codecov TypeScript

</div>

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

πŸš€ Features

βš™οΈ 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

πŸ’– Thanks

This project has been possible thanks to these great projects:

License

This project is licensed under the MIT License.