跳到內容

tmd graph

將 vault 的物件關係圖以 DOT 格式匯出。節點代表物件,邊代表 relation 和 wiki-link。輸出至 stdout,可接管到 Graphviz 或其他視覺化工具。

Terminal window
tmd graph

輸出包含所有物件為節點、所有 relation 和 wiki-link 為邊的 DOT 有向圖。

digraph vault {
rankdir=LR;
node [shape=box];
"book/clean-code-01abc" [label="📚 Clean Code"];
"person/bob-01def" [label="👤 Bob Martin"];
"book/clean-code-01abc" -> "person/bob-01def" [label="author"];
}
Terminal window
tmd graph | dot -Tpng -o graph.png
tmd graph | dot -Tsvg -o graph.svg
Terminal window
tmd graph --type book
tmd graph --type book --type person

只包含指定 type 的物件。只有當邊的兩端都在篩選集合中時才會出現邊。--type 可以重複使用。

Terminal window
tmd graph --no-wikilinks # 只顯示 relation
tmd graph --no-relations # 只顯示 wiki-link
tmd graph --no-relations --no-wikilinks # 只顯示節點

Relation 邊以實線繪製,標籤為屬性名稱。Wiki-link 邊以虛線繪製,標籤為 “wikilink”。

  • Relations:從來源到目標的有向邊,標籤為 relation 屬性名稱。雙向 relation 每個儲存方向各產生一條邊(例如 authorbooks)。
  • Wiki-links:從連結物件到目標的虛線有向邊。未解析的 wiki-link(目標不存在)會被跳過。
  • 去重:相同來源、目標和標籤的邊會被去重。