Metadata-Version: 2.4
Name: redknot
Version: 0.0.2
Summary: A lightweight dependency graph generator for C and more.
Author-email: Sanyam Asthana <sanyam.asthana@gmail.com>
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

<div align="center">
<h1>RedKnot</h1>
<img src="https://sanyam-asthana.github.io/RedKnot/logo.png" style="width: 30%;">
<br><br>

<img alt="GitHub Created At" src="https://img.shields.io/github/created-at/Sanyam-Asthana/RedKnot">
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/t/Sanyam-Asthana/RedKnot">
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/Sanyam-Asthana/RedKnot">
<br>
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/Sanyam-Asthana/RedKnot">
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/redknot?label=PyPI%20downloads">






<p>A simple dependency graph generator powered by mermaid.js</p>
</div>

## What it does
RedKnot is a dependency tree generator for your projects. It scans through the files in your project and graphs out the connections between them using mermaid.js.

[![](https://mermaid.ink/img/pako:eNptkU9vhCAQxb-KmbNrBPzLYS_da289NVzoMl1IFAxi0tb43Uu0mjb2NvPjvTcZZoa7UwgcHl4OOnm5CTsGZVymk8vlmmjsBvTZfaWdeTvhn-of9ZExBdONp4iDbsVZevh7aezJvsM_83f4O3JjkMYFjQIe_IQp9Ogjjy3MwiaJgKCxRwE8lp156CBA2CWaBmlfnet3n3fTQwN_l90Yu2lQMuDNyPh3_UE9WoX-yU02ACd1sYYAn-EDOKVlVuUNbSgpW9KSMoXPKGIko23dNi1rclbXRbWk8LWOzbOK5QVhND6xpsxJCqhMcP55u9p6vOUboECPhQ?type=png)](https://mermaid.live/edit#pako:eNptkU9vhCAQxb-KmbNrBPzLYS_da289NVzoMl1IFAxi0tb43Uu0mjb2NvPjvTcZZoa7UwgcHl4OOnm5CTsGZVymk8vlmmjsBvTZfaWdeTvhn-of9ZExBdONp4iDbsVZevh7aezJvsM_83f4O3JjkMYFjQIe_IQp9Ogjjy3MwiaJgKCxRwE8lp156CBA2CWaBmlfnet3n3fTQwN_l90Yu2lQMuDNyPh3_UE9WoX-yU02ACd1sYYAn-EDOKVlVuUNbSgpW9KSMoXPKGIko23dNi1rclbXRbWk8LWOzbOK5QVhND6xpsxJCqhMcP55u9p6vOUboECPhQ)

<center>Example of a graph generated by RedKnot</center>

## Features

Currently supported languages:

- C
- C++

RedKnot can output just the mermaid.js code as well as a simple formatted HTML document which renders the mermaid.js graph.

## Installation
RedKnot can be installed via pip:

```bash
pip install redknot
```
You can verify the installation by running:

```bash
redknot -version
```
```bash
RedKnot Version 0.0.1
By Sanyam Asthana

MIT License, 2025
```

## Usage
To use RedKnot, just run `redknot	` in your project folder.

```bash
redknot
```
```bash
graph TD
stdio.h --> helper.c
stdlib.h --> helper.c
helper.h --> helper.c
stdio.h --> utils.c
stdlib.h --> utils.c
utils.h --> utils.c
stdio.h --> main.c
stdlib.h --> main.c
helper.h --> main.c
utils.h --> main.c
```
To save the output of RedKnot to a file, you can redirect it using the redirection operator:

```bash
redknot > file.txt
```

To generate an HTML file which displays the graph, you can use the `-html` flag:

```bash
redknot -html
```
```bash

        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>MermaDep Graph</title>
        </head>
        <body>
            <pre class="mermaid">
        
				graph TD
				stdio.h --> helper.c
				stdlib.h --> helper.c
				helper.h --> helper.c
				stdio.h --> utils.c
				stdlib.h --> utils.c
				utils.h --> utils.c
				stdio.h --> main.c
				stdlib.h --> main.c
				helper.h --> main.c
				utils.h --> main.c

            </pre>

            <script type="module">
                import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
            </script>
        </body>
        </html>
```
To save the HTML output in an HTML file, you can redirect it using the redirection operator:

```bash
redknot -html > index.html
```
By default, RedKnot displays any errors while reading files as mermaid.js comments. You can disable the comments by passing the `-nocomm` flag. The `-html` flag has comments disabled by default.

## Author's Notes
Usually, I would put a section of technical details here, but since this is a one-file project which was made in like 10 minutes, there are not really a lot of details I can possible give. I am working towards supporting more languages like Python and Java, and any contribution to the project would mean a lot!

## License
MIT License

