feat: added property exclude-in-graph

- Like this thread https://discuss.logseq.com/t/option-to-ignore-certain-nodes-in-the-graph/1312, I added the ability to exclude a page in graph by adding the property exclude-in-graph:: true
	- added property exclude-in-graph
	- added settings paramenter :excluded-pages
	- added "Excluded pages" toggle in in graph filters
This commit is contained in:
8N9KT
2022-07-16 12:25:00 +02:00
parent 903e5c8a3b
commit 11436d032a
2 changed files with 20 additions and 3 deletions

View File

@@ -81,7 +81,7 @@
:links links}))
(defn build-global-graph
[theme {:keys [journal? orphan-pages? builtin-pages?]}]
[theme {:keys [journal? orphan-pages? builtin-pages? excluded-pages?]}]
(let [dark? (= "dark" theme)
current-page (or (:block/name (db/get-current-page)) "")]
(when-let [repo (state/get-current-repo)]
@@ -95,12 +95,17 @@
pages-after-journal-filter (if-not journal?
(remove :block/journal? full-pages)
full-pages)
pages-after-exclude-filter (cond->> pages-after-journal-filter
(not excluded-pages?)
(remove (fn [p] (= true (:exclude-in-graph (:block/properties p))))))
links (concat (seq relation)
(seq tagged-pages)
(seq namespaces))
linked (set (flatten links))
build-in-pages (set (map string/lower-case default-db/built-in-pages-names))
nodes (cond->> (map :block/name pages-after-journal-filter)
nodes (cond->> (map :block/name pages-after-exclude-filter)
(not builtin-pages?)
(remove (fn [p] (contains? build-in-pages (string/lower-case p))))
(not orphan-pages?)