export convert method to allow downstream adopters to leverage it#26
Conversation
|
@ChristianMurphy I'm pleased that this project can contribute to the unified/redot suite. I agree with exporting the convert function. |
|
@all-contributors please add @ChristianMurphy for code, ideas, doc |
|
I've put up a pull request to add @ChristianMurphy! 🎉 |
|
The API may change, but I've released the current main branch content as v0.5.0-1, so use it if you need it to get started on development. |
|
With the release of v0.6.0, I released the With this release, you can now be mentioned in the alternatives. As pointed out, it can cause duplication, but there are cases in the DOT language where duplication should be tolerated, and I think it can be used in such cases. For example, when specifying a common attribute for node etc., it is a case where it is affected by the declaration position. graph {
node [
shape=circle;
]
a;
node [
shape=diamond;
color=blue;
]
b;
}
If it fits your design philosophy, please use it. |

What was a problem
Working on redotjs/redot#22
I'm considering building on top of ts-graphviz.
A particular use case I have is to be able to go from a manually generated/updated AST back to a dot (text) file.
https://github.com/ts-graphviz/ts-graphviz supports this through
toDot, but this requires the class based version of the dot graph.Exporting
convertallows forAST--convert-> Graph --toDot--> Dot file flow, without copying and pastingconvertmethod into another project.How this PR fixes the problem
By exporting the method so it can be leveraged down stream
Check lists
Additional Comments (if any)
An alternative path, to compile the AST directly, rather than going through the class/graph representation, could also work.
But could be more complex, and cause duplication.