inheritance-diagram
v3.1.1
Published
Build an inheritance diagram for a class
Downloads
148
Maintainers
Readme
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
Arrows at the end of connection line cannot inherit the line styles (colors).
- SVG v2 will fix this by defining the context: Specifying paint
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
});
});