Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elmouradiaminedev/diagonjs
:fire: Craft captivating ASCII art from your Markdown expression
https://github.com/elmouradiaminedev/diagonjs
ascii diagon interpreter javascript latex node npm typescript unicode
Last synced: 25 days ago
JSON representation
:fire: Craft captivating ASCII art from your Markdown expression
- Host: GitHub
- URL: https://github.com/elmouradiaminedev/diagonjs
- Owner: elmouradiaminedev
- License: mit
- Created: 2024-02-10T19:04:42.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-16T07:15:00.000Z (about 1 month ago)
- Last Synced: 2024-11-16T07:17:03.626Z (about 1 month ago)
- Topics: ascii, diagon, interpreter, javascript, latex, node, npm, typescript, unicode
- Language: TypeScript
- Homepage:
- Size: 409 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Diagonjs
[![npm version](https://img.shields.io/npm/v/diagonjs)](https://www.npmjs.com/package/diagonjs)
[![npm downloads](https://img.shields.io/npm/dm/diagonjs)](https://www.npmjs.com/package/diagonjs)
![CI status](https://github.com/elmouradiaminedev/diagonjs/actions/workflows/ci.yml/badge.svg)
[![codecov](https://codecov.io/gh/elmouradiaminedev/diagonjs/graph/badge.svg?token=TYVEPNWRD3)](https://codecov.io/gh/elmouradiaminedev/diagonjs)
[![TypeScript](https://badgen.net/badge/icon/TypeScript?icon=typescript&label)](https://www.typescriptlang.org/)Craft captivating ASCII art from your Markdown expression with ease, powered by [Diagon](https://github.com/ArthurSonzogni/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:
```bash
npm i diagonjs
# Or Yarn
yarn add diagonjs
# Or pnpm
pnpm add diagonjs
```## π Usage
### Initialize diagonjs
To initialize diagon.js in your application:
```js
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:
```js
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:
```js
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](https://github.com/elmouradiaminedev/diagonjs/blob/main/src/translators/index.ts)
- Find practical integrations with express, react and more in the [examples section](https://github.com/elmouradiaminedev/diagonjs/tree/main/examples).
- Explore the [test section](https://github.com/ArthurSonzogni/Diagon/tree/main/test) in the Diagon C++ repository. It contains input and output samples.
- Experience Diagonjs in action using the [online interpreter](https://arthursonzogni.com/Diagon/).## π Thanks
This project has been possible thanks to these great projects:
- [Diagon](https://github.com/ArthurSonzogni/Diagon)
- [Emscripten](https://github.com/emscripten-core/emscripten)
- [WebAssembly](https://webassembly.org/)
- [Node](https://github.com/nodejs/node/tree/main)## License
This project is licensed under the [MIT](https://github.com/elmouradiaminedev/diagonjs/blob/main/LICENSE) License.