Graph Visualization Module¶
This section was the underlying module of the network graph visualization feature which migrated from MkDocs Network Graph Plugin.
It will be called by plugin core directly.
Graph data structure and manipulation.
Migrated from mkdocs-network-graph-plugin.
Graph ¶
Represents the connection graph between files.
Source code in src/mkdocs_note/graph.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__call__(files) ¶
Build the graph from the file collection.
Source code in src/mkdocs_note/graph.py
108 109 110 111 112 113 | |
__init__(config) ¶
Initializes the graph data structure.
Source code in src/mkdocs_note/graph.py
29 30 31 32 33 34 35 36 | |
to_dict() ¶
Return the graph as a dictionary.
Source code in src/mkdocs_note/graph.py
115 116 117 | |
add_static_resouces(config) ¶
Add static resources into mkdocs config for network graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MkDocsConfig | The MkDocs configuration. | required |
Source code in src/mkdocs_note/graph.py
120 121 122 123 124 125 126 127 128 129 130 131 | |
copy_static_assets(static_dir, config) ¶
Copy static assets into the site directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MkDocsConfig | The MkDocs configuration. | required |
Source code in src/mkdocs_note/graph.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
inject_graph_script(output, config, debug=False) ¶
Inject the graph script into the HTML page.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output | str | The HTML output. | required |
config | MkDocsConfig | The MkDocs configuration. | required |
debug | bool | Whether to enable debug mode. | False |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The HTML with the graph script injected. |
Source code in src/mkdocs_note/graph.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |