This is a fork from HDElk. Some features are added:
- arrow-head at edge termination
- Bi-directional edge with
bidir
option (reverse is not supported) - show dimension in port and edge label with
rank
option (e.g.:rank: [2,8]
automatically appends[1:0][7:0]
to the label) - multi-line node and edge label
- You can add description to nodes/edges with
desc
property for them. The description font size is 0.8x (DEFAULT_DESC_FONT_SIZE_SCALER
inhdelk.js
) of that for node name / edge label. - You can override edge bus visual width by
edge_bus_visual_width
argument ofhdelk.layout
function (e.g.hdelk.layout(graph, "diagram", edge_bus_visual_width=3)
). - You can specify
thoroughness
layout algorithm parameter of ELK.hdelk.layout(graph, "title", [thoroughness]);
- You can fix port orders with
fixPortOrder: true
option (prevent from being sorted in layout calculation) per node. - C-style comments in
.jsonc
file (see: C-style comments and Julia-based string interpolation) - Julia-based string interpolation (see: C-style comments and Julia-based string interpolation)
- new colors
This program is tested in the following environment:
- GNU bash 5.1.16
- GNU sed 4.8
- Python 3.10.13
- Julia 1.10.2
-
Put constants used in JSONC file in
constants.jl
. This.jl
file should be placed in the same directory as the target JSONC file. Example usage is shown inexample/constants.jl
. -
Write the target JSONC file. In this file, the HDElk syntax is valid. In addition, the following features can be used:
- C-style comments (
/* ... */
) - Julia string interpolation (
$(...)
)
Example usage is shown in
example/example_count.jsonc
. - C-style comments (
-
Run the following command:
py_scripts/jsonc2html.py <path to the target JSONC file> # example: # $ py_scripts/jsonc2html.py example/example_count.jsonc
The intermediate
julia_code.jl
is generated and Julia runs it. -
The generated HTML file's base name is the same as that of the input JSONC file. To render this HTML file, make sure that HDElk's
js
folder is in the same directory as the HTML file (or you can modify the js library path in the html template injsonc2html.py
script, or manually edit the generated html file).
js/hdelk.js
HDElk depends the following libraries:
- elkjs v0.9.2:
LICENSE_elkjs.md