npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

diagonjs

v1.6.1

Published

A library for converting Markdown-style expressions into visually appealing ASCII, Unicode and LaTeX representations.

Downloads

588

Readme

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.