org-roam-ui的视图展示方式?

用org-roam 进行笔记的记录非常方便,再用org-roam-ui可以进行反向链接的展示:

这样的图是以一个中心向四周扩散的展示方式。 如果笔记之间有一定的逻辑关系,或一定的层次关系,而不是简单的连接。 org-roam-ui 是否可以通过修改实现如下的展示方式?节点从上到下的排列,同一层次的节点并排。

2 个赞

可以学习下你的配置吗?谢谢 :pray:

我配置了半天没运行起来,org-roam.db 文件建立了但是 ORUI 是空的。

你用 org-roam-graph 就可以,org-roam-ui 不行。

看起来像这样:

可以参考下面的链接: https://hsingko.github.io/post/2021/05/04/migrate-to-org-roam-v2-in-doom-emacs/

1 个赞

org-roam-graph确实可以输出节点连接图,但是功能上没有org-roam-ui 强大,org-roam-ui 的交互性更好。

好的,谢谢,我去看看。 :grimacing:

其实都没什么用,使用了很久的 org-roam 这个org-roam-ui就很少打开看。

1 个赞

啊?等等,我这篇里面好像没有说要怎么配置 ui 啊。 而且是一年前的帖子,有点过时了,用的还是 doom 的配置……

:rofl: 我先去折腾别的设置,回头再好好研究 org-roam。

主要是我的 markdown 文件有点多,想同时用 org-roam 和 md-roam。跟着官方教程配置完了,既不能内部链接跳转也没有知识图谱,等我折腾好了也写个 vanilla 版的配置说明。

如何将org-roam-graph图中的圆形改成矩形的?

org-roam-graph 调用的是 Graphviz 命令。

看看源码或许可以找到方法覆盖默认命令。

看起来像是下面的代码,但是当我将其中的rounded改为box或rectangle 输出的形状都没有变化?

(defcustom org-roam-graph-node-extra-config
  '(("id" . (("style"      . "bold,rounded,filled")
             ("fillcolor"  . "#EEEEEE")
             ("color"      . "#C9C9C9")
             ("fontcolor"  . "#111111")))
    ("http" . (("style"      . "rounded,filled")
               ("fillcolor"  . "#EEEEEE")
               ("color"      . "#C9C9C9")
               ("fontcolor"  . "#0A97A6")))
    ("https" . (("style"      . "rounded,filled")
                ("fillcolor"  . "#EEEEEE")
                ("color"      . "#C9C9C9")
                ("fontcolor"  . "#0A97A6"))))
  "Extra options for graphviz nodes."

我才刚用起来 org-roam,搞不懂怎么定制 graph。

Emacs 默认的 image-mode 太难用了,我现在一直用 org-roam-ui 看图。

浏览器+触控板真的是一绝,既能看全局知识图谱,也能双击看局部,相比 Graphviz 更具交互性。

回到你最开始问的问题,双击查看局部知识图谱应该是最好的答案了。

不知道,没试过。看源码,是不支持定制,你要自己修改下面的函数:

(defun org-roam-graph--build (graph &optional callback)
  "Generate the GRAPH, and execute CALLBACK when process exits successfully.
CALLBACK is passed the graph file as its sole argument."
  (unless (stringp org-roam-graph-executable)
    (user-error "`org-roam-graph-executable' is not a string"))
  (unless (executable-find org-roam-graph-executable)
    (user-error (concat "Cannot find executable \"%s\" to generate the graph.  "
                        "Please adjust `org-roam-graph-executable'")
                org-roam-graph-executable))
  (let* ((temp-dot   (make-temp-file "graph." nil ".dot" graph))
         (temp-graph (make-temp-file "graph." nil (concat "." org-roam-graph-filetype))))
    (org-roam-message "building graph")
    (make-process
     :name "*org-roam-graph*"
     :buffer " *org-roam-graph*"
     :command `(,org-roam-graph-executable ,temp-dot "-T" ,org-roam-graph-filetype "-o" ,temp-graph)
     :sentinel (when callback
                 (lambda (process _event)
                   (when (= 0 (process-exit-status process))
                     (progn (funcall callback temp-graph)
                            (run-hook-with-args 'org-roam-graph-generation-hook temp-dot temp-graph))))))))