Quartz 提供了一个图谱视图,可以同时显示本地图谱和全局图谱。

  • 本地图谱显示链接到当前文件或从当前文件链接出去的文件。换句话说,它展示了所有与当前笔记最多相隔一跳距离的笔记。
  • 全局图谱可以通过点击本地图谱右上角的图表图标切换显示。它展示了知识库中所有笔记及其相互连接关系。

默认情况下,节点半径与该文件传入和传出的内部链接总数成正比。

此外,类似于浏览器会用不同颜色标记已访问链接,图谱视图也会用不同颜色显示您已访问过的节点。

Info

图谱视图需要ContentIndex发射器插件存在于配置中。

自定义设置

大部分配置可以通过向Component.Graph()传递选项来实现。

例如,以下是默认配置的示例:

quartz.layout.ts
Component.Graph({
  localGraph: {
    drag: true, // whether to allow panning the view around
    zoom: true, // whether to allow zooming in and out
    depth: 1, // how many hops of notes to display
    scale: 1.1, // default view scale
    repelForce: 0.5, // how much nodes should repel each other
    centerForce: 0.3, // how much force to use when trying to center the nodes
    linkDistance: 30, // how long should the links be by default?
    fontSize: 0.6, // what size should the node labels be?
    opacityScale: 1, // how quickly do we fade out the labels when zooming out?
    removeTags: [], // what tags to remove from the graph
    showTags: true, // whether to show tags in the graph
    enableRadial: false, // whether to constrain the graph, similar to Obsidian
  },
  globalGraph: {
    drag: true,
    zoom: true,
    depth: -1,
    scale: 0.9,
    repelForce: 0.5,
    centerForce: 0.3,
    linkDistance: 30,
    fontSize: 0.6,
    opacityScale: 1,
    removeTags: [], // what tags to remove from the graph
    showTags: true, // whether to show tags in the graph
    enableRadial: true, // whether to constrain the graph, similar to Obsidian
  },
})

当传入自己的配置项时,如果想保留某个字段的默认值,可以省略该字段的全部或部分设置。

想要进一步自定义?

  • 移除图谱视图: 从 quartz.layout.ts 中删除所有对 Component.Graph() 的调用
  • 组件: quartz/components/Graph.tsx
  • 样式: quartz/components/styles/graph.scss
  • 脚本: quartz/components/scripts/graph.inline.ts