Foliant Meta Command which draws a scheme of project sections.
Foliant Meta Command which draws a scheme of project sections. This extension uses meta-information, collected by folinatcontrib.meta extension.
Graphviz is used to build a scheme.
libgraphviz-dev is required to be installed on your machine.
$ pip install foliantcontrib.project_graph
First you need to specify all relations between the documents in your project. To do this add the
relates section to your document's meta-data:
--- relates: - tests/test1.md - specs/spec.md ---
relates section you need to specify a list of documents to which current document relates. You can specify either a relative path to connected document or its ID (if the corresponding document has an ID assigned in its meta section):
# index.md --- id: index ---
# glossary.md --- relates: - index ---
After you specified all relations, run the draw command:
$ foliant draw
Scheme will appear in the file
ProjectGraph has a number of options:
project_graph: directed: false filename: project_graph.png gv_attributes: node: shape: rect color: green edge: arrowhead: open graph: ranksep: 1 main_relation: penwidth: 2
: Specifies graph to be directed or not. Default:
: Graph output filename. Default:
: A dictionary with global attributes of the graph. Each dictionary should be stored under the Graphviz Entity key (
graph), or under type key. All sections or relations which have this type will get these attributes.
If you want to adjust the look of just one node, add a
gv_attributes option into the meta of the document:
--- id: index relates: - glossary gv_attributes: color: green shape: circle ---
You can also change the look of the edges, which connect nodes. To do this you can use a detailed syntax of relations.
Relations detailed syntax
As stated in the beginning, to specify relations you need to add a
relates param and include a list of related documents IDs\file paths:
--- relates: - doc1.md - MAIN_SPEC ---
But there's also a detailed syntax for specifying relations, it looks like this:
--- relates: - rel_path: doc1.md type: details - rel_id: MAIN_SPEC gv_attributes: color: #CCCCCC arrowhead: none ---
In the detailed syntax each relation is not a string, but a mapping. This time you have to explicitly use either
rel_path key, if you are pointing to a document by path, or
rel_id if you do it by ID.
Also you can specify relation type by adding a
type key. Right now the value of this key just goes to the edge label, but soon you'll be able to change the appearance of all edges with one type.
Finally you can override this specific edge's appearance by adjusting Graphviz attributes in the
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size foliantcontrib.project_graph-1.0.1-py3-none-any.whl (6.9 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size foliantcontrib.project_graph-1.0.1.tar.gz (5.5 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for foliantcontrib.project_graph-1.0.1-py3-none-any.whl
Hashes for foliantcontrib.project_graph-1.0.1.tar.gz