Skip to main content

Foliant Meta Command which draws a scheme of project sections.

Project description

ProjectGraph

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.

Installation

$ pip install foliantcontrib.project_graph

Usage

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
---

in 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 project_graph.png

Config

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

directed : Specifies graph to be directed or not. Default: false

filename : Graph output filename. Default: project_graph.png

gv_attributes : A dictionary with global attributes of the graph. Each dictionary should be stored under the Graphviz Entity key (node, edge, or 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 gv_attributes key.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foliantcontrib.project_graph-1.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file foliantcontrib.project_graph-1.0.1.tar.gz.

File metadata

  • Download URL: foliantcontrib.project_graph-1.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.14.2 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

File hashes

Hashes for foliantcontrib.project_graph-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c7892ab8df5216a4410941493150181510ff9514e76c89b00ce8c9deecf78ef5
MD5 05949c38639e615e1f0953802e00afd1
BLAKE2b-256 3f315083cd37dde376f296dfb2ef58aa17ad4c908994a5d2504f19108db01450

See more details on using hashes here.

File details

Details for the file foliantcontrib.project_graph-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: foliantcontrib.project_graph-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.14.2 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

File hashes

Hashes for foliantcontrib.project_graph-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89cf6cadf9f9d2ac69e3db0ff61adae53b3bd489005919cc14082969a45281e3
MD5 3b76969b6bec731da7967a51cf32e53e
BLAKE2b-256 13ae03f8a29c2512ed4e24ab50f70636e15f67fa36fb38fdd092a7344ea06fb0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page