/roam-viz

Generic UI for an org-roam notes database

Primary LanguageClojure

transform local org-roam database into a nice website!

instructions

  • repl: cider-jack-in-clj&cljs clj -M:cljs
  • build roam db:
    • clj -X:build-db will default to dev path in public/ and my personal roam db path.
      • override to your db by adding =:roam-db-path ‘”/path/to/your/org-roam.db”’= path.
  • build prod db & compile cljs:
    clj -X:build-db :db-out-path '"./docs/db.edn"'
    clj -X:cljs:compile
        
  • optionally update kev.roam.data-import/all-links-with-source-nodes to query your org-roam database. I have a custom query with some custom exclusions.
  • update docs/index.html to use your currect db path (near bottom of file)

impl

how to handle data?

  • make just plain edn file w/ all the node and link data
    • it’s pretty simple, so probably datascript isn’t required.
  • make datascript db in one batch, give to UI.
    • then can mess with database and not have to worry about UI
    • separate resource for this?
      • then the UI can completely be a template and there is no
    • have macro build the db as an update
      • easier initially. updates require a recompile. That’s annoying.
  • SOLUTION:
    • datascript db stored in a separate file
    • the ONLY user-specific thing is that file. Then I guess also the path where that is. And this needs to be known by the code. will figure that out.

roam db schemata

(defconst org-roam-db--table-schemata
  '((files
     [(file :unique :primary-key)
      title
      (hash :not-null)
      (atime :not-null)
      (mtime :not-null)])

    (nodes
     ([(id :not-null :primary-key)
       (file :not-null)
       (level :not-null)
       (pos :not-null)
       todo
       priority
       (scheduled text)
       (deadline text)
       title
       properties
       olp]
      (:foreign-key [file] :references files [file] :on-delete :cascade)))

    (aliases
     ([(node-id :not-null)
       alias]
      (:foreign-key [node-id] :references nodes [id] :on-delete :cascade)))

    (citations
     ([(node-id :not-null)
       (cite-key :not-null)
       (pos :not-null)
       properties]
      (:foreign-key [node-id] :references nodes [id] :on-delete :cascade)))

    (refs
     ([(node-id :not-null)
       (ref :not-null)
       (type :not-null)]
      (:foreign-key [node-id] :references nodes [id] :on-delete :cascade)))

    (tags
     ([(node-id :not-null)
       tag]
      (:foreign-key [node-id] :references nodes [id] :on-delete :cascade)))

    (links
     ([(pos :not-null)
       (source :not-null)
       (dest :not-null)
       (type :not-null)
       (properties :not-null)]
      (:foreign-key [source] :references nodes [id] :on-delete :cascade)))))

todo

  • [ ] be able to link to arbitrary stuff
    • such as
      • locations of links to other node files (so backlinks can point there)
      • arbitrary subheadings (for table of contents)
  • [ ] table of contents for big pages?
    • idk this may not work bc I change stuff around so much. Can generate id’s for nodes, but this might be a little annoying.
  • [ ] fix search slowness
  • [ ] hover over org links should preview the ref.
  • [-] various org features
    • make max-width for post text. Look at blog for doing this.
    • [ ] code sections
    • [X] block quotes
  • [X] Make more similar to local emacs experience by changing font weight and size on headings rather than using :h1 :h2… The indentation level should convey the size anyways.
  • [X] make reusable for other people’s roam graphs
  • [X] parse org files into posts. Router for posts.
    • tried doing the existing parser. This didn’t work.
  • [X] noticed that “sibo” node didn’t show in graph. Are nodes w/ no links being evicted?