Last active
May 15, 2022 13:29
-
-
Save zilongshanren/0e05454f38a16e6a53458d8ff3e6a7c8 to your computer and use it in GitHub Desktop.
migrage logseq to org roam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-insert-file-content (filename) | |
(interactive) | |
(if (f-file-p filename) | |
(progn | |
(setq org-roam-capture-templates '(("d" "default" plain "%?" | |
:target (file+head "%(format-time-string \"%Y%m%d%M%H%S\")-%(file-name-base filename).org" "#+title: %(file-name-base filename) \n %(f-read-text filename) \n ") :unnarrowed t))) | |
(org-roam-capture) | |
))) | |
(advice-add 'org-roam-capture :after 'org-capture-finalize) | |
(cl-defun org-roam-capture (&optional goto keys &key filter-fn templates info) | |
"Launches an `org-capture' process for a new or existing node. | |
This uses the templates defined at `org-roam-capture-templates'. | |
Arguments GOTO and KEYS see `org-capture'. | |
FILTER-FN is a function to filter out nodes: it takes an `org-roam-node', | |
and when nil is returned the node will be filtered out. | |
The TEMPLATES, if provided, override the list of capture templates (see | |
`org-roam-capture-'.) | |
The INFO, if provided, is passed along to the underlying `org-roam-capture-'." | |
(interactive "P") | |
(let ((node (org-roam-node-create))) | |
(org-roam-capture- :goto goto | |
:info info | |
:keys keys | |
:templates templates | |
:node node | |
:props '(:immediate-finish nil)))) | |
;; 替换成你自己的目录 | |
(mapc 'my-insert-file-content (directory-files "~/Github/my-notes/pages/" t)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment