Skip to content

tensorush/meduza

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

83 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🦎 πŸ§œβ€β™€οΈ meduza

CI CD MZ LC

Zig codebase graph generator that emits a Mermaid class diagram.

πŸš€ Usage

git clone https://github.com/tensorush/meduza.git
cd meduza/
zig build exe -- -h

✨ Features

  • Generate either .html, .md, or .mmd Mermaid class diagram.

  • Generate one diagram for each of your codebase's source directories.

  • Learn how to improve code readability from logged tips (enable with -i).

  • Convert .md or .mmd diagram to .svg with Mermaid CLI (see CD pipeline).

  • Generate a large diagram (maxTextSize > 250'000) with Mermaid CLI (see CD pipeline).

  • Click on types to go to respective code lines on the remote (GitHub Mermaid forbids this, though).

πŸ—ΊοΈ Legend

---
title: Title (path/to/directory)
---
%%{
    init: {
        'theme': 'base',
        'themeVariables': {
            'fontSize': '18px',
            'fontFamily': 'arial',
            'lineColor': '#F6A516',
            'primaryColor': '#28282B',
            'primaryTextColor': '#F6A516'
        }
    }
}%%
classDiagram
class `file.zig` {
    fld: T
    test "tst"()
}
class Error["Error [err]"] {
    Value
}
class Enum["Enum [enu]"] {
    Value
    +func(arg) E!R
}
class Union["Union [uni]"] {
    fld: T
    +func(arg) E!R
}
class Struct["Struct [str]"] {
    fld: T
    +func(arg) E!R
}
class Opaque["Opaque [opa]"] {
    fld: T
    +func(arg) E!R
}
`file.zig` <-- Error
`file.zig` <-- Enum
`file.zig` <-- Union
`file.zig` <-- Struct
`file.zig` <-- Opaque
Type Zig Meduza
File file.zig class file.zig {}
Error const Error = error { Value, }; class Error["Error [err]"] { Value }
Enum const Enum = enum { Value, }; class Enum["Enum [enu]"] { Value }
Union const Union = union { fld: T, }; class Union["Union [uni]"] { fld: T }
Struct const Struct = struct { fld: T, }; class Struct["Struct [str]"] { fld: T }
Opaque const Opaque = opaque { fld: T, }; class Opaque["Opaque [opa]"] { fld: T }
Function pub fn / fn func(arg) E!R {} + / - func(arg) : E!R
Error union error{Value}!struct { fld: T } error[Value]!struct [ fld: T ]
Test function test "tst" {} test "tst"()
Type relation B.zig: const A = enum { Value, }; B.zig <-- A