inheritance-diagram

3.1.1 • Public • Published

Inheritance diagram builder

This builds an inheritance diagram for some node of interest (NOI). Initially it is designed to use in documentations with class description to show parent stack, mixed in nodes and the whole tree of children.

Nodes that contains link property will be highlighted and will behave as usual link element to allow fast jumping to the next interested node in the documentation.

Mainly this library was created for JSDoc (the JSDoc plugin is jsdoc-inheritance-diagram), but it can be used as a core for other purposes.

Limitations and known issues

  1. Arrows at the end of connection line cannot inherit the line styles (colors).

Due to upcomming features/improvements in SVG v2 the above limitations will not have coded workarounds.

Hope SVG v2 will be released and implemented by browsers soon, or maybe some other idea comes to me later :)

Links

Exmaple

The example can be found in example.js file.

npm install inheritance-diagram
node example.js

If CSS from an external file must be applied to the diagram, then an additional code is needed for this, for example:

const diagramBuilder = require('inheritance-diagram');
 
require('fs').readFile('styles.css', 'utf8', async (err, data) => {
    if (err) {
        throw err;
    }
 
    const result = await diagramBuilder('inheritance-diagram'))('...', {...}, {
        css: data
    });
});

Result

Example of an inheritance diagram

Package Sidebar

Install

npm i inheritance-diagram

Weekly Downloads

1,276

Version

3.1.1

License

MIT

Unpacked Size

46.3 kB

Total Files

11

Last publish

Collaborators

  • valerii-zinchenko