Code Monkey home page Code Monkey logo

md-roam's Introduction

License GPL 3

Use Org-roam with Markdown files by adding Md-roam to it. Md-roam extends the features and functions provided by Org-roam to support Markdown files. Mix Markdown with Org files in a single Org-roam database for your Zettelkasten-style note-taking and backlinks.

Screen shot showing main features of Org-roam supported by Md-roam

  1. Title and other meta data in the YAML front matter

  2. #tag support to categorize notes

  3. Note as a reference material (literature notes or notes on website) with roam_refs:

  4. Aliases of a note with roam_aliases: in the YAML array syntax with ["alias1", "alias two"]

  5. Link with [[wiki-link]] syntax that appears as a backlink and "in-line search" with Company or Corfu; you can use the title or an alias of a note

  6. Citations with Pandoc style [@citekey], @citekey -@citekey, etc. for Markdown files; for Org, Org-ref or Org-cite styles as Org-roam support them

  7. Markdown and Org citations for reference materials; they appear in the reflink section

  8. Backlinks between Org and Markdown files both ways; you can mix both formats in a single Org-roam database

  9. Org-roam standard backlink buffer with no modification to the database schema and backlink buffer

  10. Graph and note preview by Org-roam-ui (ORUI)

Graph and note preview by ORUI

Getting Started

Installation

This package is not available on MELPA or ELPA. Manual installation is required.

Download or clone this repo, put the .el file into your load-path, and put something like this in your init file.

(add-to-list  'load-path "path/to/md-roam")

Basic Configuration

Org-roam must be configured before Md-roam. As a minimal configuration for Md-roam, these should be sufficient:

  • (setq org-roam-file-extensions '("org" "md")) ; enable Org-roam for a markdown extension
  • (md-roam-mode 1) ; md-roam-mode needs to be active before org-roam-db-sync
  • (setq md-roam-file-extension "md") ; Default is "md". Specify an extension such as "markdown"
(require 'org-roam)
(setq org-roam-directory (file-truename "path/to/org-roam-directory"))
;; file-truename is optional; it seems required when you use symbolic
;; links, which Org-roam does not resolve
(setq org-roam-file-extensions '("org" "md")) ; enable Org-roam for a markdown extension
(add-to-list 'load-path "path/to/md-roam") ; installation as above
(require 'md-roam)
(md-roam-mode 1) ; md-roam-mode must be active before org-roam-db-sync
(setq md-roam-file-extension "md") ; default "md". Specify an extension such as "markdown"
(org-roam-db-autosync-mode 1) ; autosync-mode triggers db-sync. md-roam-mode must be already active

Additionally, you can use org-roam-capture-templates for Markdown files like this:

(add-to-list 'org-roam-capture-templates
    '("m" "Markdown" plain "" :target
        (file+head "%<%Y-%m-%dT%H%M%S>.md"
"---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: \n---\n")
    :unnarrowed t))

For interactive commands, you can use Org-roam's standard ones. There is no specific commands for Md-roam:

;;;; Org-roam
(define-key global-map (kbd "C-c n f") #'org-roam-node-find)
(define-key global-map (kbd "C-c n c") #'org-roam-capture)
(define-key global-map (kbd "C-c n i") #'org-roam-node-insert)
(define-key global-map (kbd "C-c n l") #'org-roam-buffer-toggle)

"In-line search" with Company and Corfu

With Md-roam, you can use completion-at-point for wiki links within Org-roam. Md-roam currently does not implement support for org-roam-complete-everywhere. I will not be able to provide a fix any time soon -- please consider this option unsupported (see issue #82)

Corfu animation

For Company, there is no specific configuration. Md-roam implements completion-at-point (or capf); use it as a Company backend. For more detail, refer to Company's documentation.

For Corfu, add something like this below to get Tab to work for corfu-mode. By default, Markdown-mode's Tab function does not use complete-at-point like Org-mode's equivalent does.

(with-eval-after-load 'markdown-mode
  (advice-add #'markdown-indent-line :before-until #'completion-at-point))

License

Md-Roam: Copyright © Noboru Ota Org-Roam: Copyright © Jethro Kuan and contributors.

Distributed under the GNU General Public License, Version 3

md-roam's People

Contributors

acowley avatar bdarcus avatar braun-steven avatar celeritascelery avatar chip2n avatar daniel-koudouna avatar dit7ya avatar frigge avatar herbertjones avatar jdormit avatar jethrokuan avatar juergenhoetzel avatar kljohann avatar l3kn avatar langston-barrett avatar michaelherold avatar mossbanay avatar myshevchuk avatar nobiot avatar philip-bl avatar progfolio avatar rasendubi avatar rcoeurjoly avatar ryjm avatar sergiey avatar teesloane avatar timquelch avatar tsproisl avatar wannli avatar zaeph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

md-roam's Issues

(help) Doom Emacs setup

I have org-roam version 2 and org-roam-ui setup with Doom Emacs. How can I add md-roam to this setup?

md-roam-follow-wiki-link looks for node without stripping 'roam:' prefix

Steps to reproduce:

  1. After setting up md-roam, insert link to org-roam node (.org file) using completion
  2. Link inserted looks like [[roam:2022_06_10]]
  3. With cursor on link press enter
  4. Capture process is activated. *Messages* shows No org-roam node found for "roam:2022_06_10"
  5. Remove roam: from wikilink manually
  6. With cursor on link press enter
  7. Expected node is opened

Expected:

  • should not need to strip roam: manually

Not able to complete/insert links in markdown files

I'm trying to use md-roam with Doom Emacs. org with +roam have been enabled in init.el and seems to work well. I have added the following to my packages.el for md-roam:

(package! md-roam
  :recipe (:host github :repo "nobiot/md-roam"))

… and the following to my config.el:

(use-package! md-roam
  :after org-roam
  :config
  (setq org-roam-file-extensions '("org" "md"))
  (md-roam-mode 1)
  (org-roam-db-autosync-mode 1)
  (add-to-list 'org-roam-capture-templates
               '("m" "Markdown" plain "" :target
                 (file+head "%<%Y-%m-%dT%H%M%S>-${slug}.md"
                            "---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: \n---\n")
                 :unnarrowed t))
  )

I then created the following file using org-roam-node-find and the “Markdown” template:

---
title: md-roam
id: 2021-11-29T092121
category: #emacs
---

hello, md-roam. 

So far, so good. The file is indexed and findable, and I can link to it from existing .org files. However, when I attempt to insert a link in the markdown file by typing [[Emac, I don't get any completion like I get in .org files. If I leave it like [[Emacs]], I get the following error when I save the file:

Warning (emacs): org-element--cache: Cache corruption detected in 2021-11-29T092121-md_roam.md. Resetting.
 The error was: (error "rx ‘**’ range error")
 Backtrace:
nil
 Please report this to Org mode mailing list (M-x org-submit-bug-report).
Error (before-save-hook): Error running hook "org-roam-link-replace-all" because: (error rx ‘**’ range error)

If I don't type [[, but just type Emac and then use completion-at-point, [[roam:Emacs]] gets inserted, and I get this error:

Warning (emacs): org-element--cache: Cache corruption detected in 2021-11-29T092121-md_roam.md. Resetting.
 The error was: (error "rx ‘**’ range error")
 Backtrace:
"  backtrace-to-string(nil)
  org-element-at-point(nil)
  org-element-context()
  org-roam-link-replace-at-point()
  org-roam-link-replace-all()
  funcall(org-roam-link-replace-all)
  (condition-case e (funcall hook) ((debug error) (signal 'doom-hook-error (list hook e))))
  doom-run-hook(org-roam-link-replace-all)
  run-hook-wrapped(doom-run-hook org-roam-link-replace-all)
  (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error \"Error running hook %S because: %s\" (if (symbolp (car (cdr e))) (symbol-name (car (cdr e))) (car (cdr e))) (car (cdr (cdr e))))) (signal 'doom-hook-error (cons hook (cdr e)))))
  (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error \"Error running hook %S because: %s\" (if (symbolp (car ...)) (symbol-name (car ...)) (car (cdr e))) (car (cdr (cdr e))))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (while --dolist-tail-- (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error \"Error running hook %S because: %s\" (if (symbolp ...) (symbol-name ...) (car ...)) (car (cdr ...)))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--))))
  (let ((--dolist-tail-- hooks)) (while --dolist-tail-- (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error \"Error running hook %S because: %s\" (if ... ... ...) (car ...))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  doom-run-hooks(before-save-hook)
  apply(doom-run-hooks before-save-hook)
  run-hooks(before-save-hook)
  basic-save-buffer(nil)
  save-buffer()
  evil-write(nil nil nil nil nil)
  funcall-interactively(evil-write nil nil nil nil nil)
  call-interactively(evil-write)
  evil-ex-call-command(nil #(\"w\" 0 1 (ex-index 1)) nil)
  eval((evil-ex-call-command nil #(\"w\" 0 1 (ex-index 1)) nil))
  evil-ex-execute(#(\"w\" 0 1 (ex-index 1)))
  evil-ex(nil)
  funcall-interactively(evil-ex nil)
  call-interactively(evil-ex nil nil)
  command-execute(evil-ex)
"
 Please report this to Org mode mailing list (M-x org-submit-bug-report).
Error (before-save-hook): Error running hook "org-roam-link-replace-all" because: (error rx ‘**’ range error)

I'm not a very experience Emacs user, so it could be something very rudimentary. I'm happy to hear if someone knows how to fix this.

(Test) multicite links

Upstream commit 0132546 includes a new feature multicite links #545

As it is related to org-ref, it may not be relevant for md-roam. Determine if it is relevant, and test it if it is.

org-ref multi-citations are handled by "cite:key1,key2". In the org-roam databases this was
previously stored as a single "cite" link to the (non-existing) key "key1,key2". This means that
cite backlinks and cite graph behaviour does not work correctly for these links.

Add subnode in same file

Hi,

I realized I could add subnote in the same file with org-id-get-create. Then that block will have additional property and will be indexed by roam.

Is there any function exist in md-roam?

Thanks

How to select what type should I insert note .org or .md

After read issue #49 . I found the next solution for force file, which I insert, create with .md format:

(setq org-roam-file-extensions '("md" "org"))

But md-roam is addon for org-roam. And I use it only for documentations, but notes I prefer hold in org files. How can I select the type of file for org-roam?

(Bug) Duplicate of titles in `org-roam-insert`

Test outcome #1 seems to have revealed a bug?

See the red-hightlighted part of the screen shot.
In the minibuffer for org-roam-insert, you have duplicate of titles for the same file. The titles are slightly different, but they both point to the same file.

2020-05-02T1611a

(feat) Support markdown [title](filename.md#header) in backlinks?

Currently, traditional markdown links can be detected for [title](filename.md), but not for [title](filename.md#header). It would be great if the latter is also considered when generating the backlinks database.

For example:

<!--a.md-->

# A

[Link to B that works](b.md)
<!--b.md-->

# B
[Link to A that does NOT work](a.md#A)

(fix) YAML front matter must be the top of the file

At the moment, YAML front matter can be placed anywhere in the buffer, and md-roam will pick up the title, etc. from it.

This is not good.

Pandoc document specifies the front matter is at the top of a file:

A YAML metadata block is a valid YAML object, delimited by a line of three hyphens (---) at the top and a line of three hyphens (---) or three dots (...) at the bottom.

(test) upstream update from v1.1.1 to v1.2 30599cc..408e38f (2020-06-21)

https://github.com/org-roam/org-roam/compare/30599cc..408e38f

There have been many good changes.
Need to sort out what's relevant for Md-roam and test them.

But... my quick testing suggest that Md-roam as of today (2020-06-21) works with upstream commmit 408e38f (1.2.0).
Linking to headline is not relevant for markdown files, so there will be no support [edit: this refers to linking to headings via Org-IDs; may be there is a way to achieve this via [[wiki-link#heading]]]
But it may be worth thinking about linking from md to org including headnig. That take time, and I don't think I will use it so low prio for me at the moment. I will see.

1.2.1 (TBD)

Features

  • #814 Implement org-roam-insert-immediate
  • #833 Add customization of file titles with org-roam-title-to-slug-function.
  • #839 Return selected file from org-roam-insert
  • #847 Add GC threshold org-roam-db-gc-threshold to temporarily change the threshold on expensive operations.
  • #847 Use sqlite3 transactions instead of storing the values to be inserted.
  • #851 Add 'first-directory' option for org-roam-tag-sources

Features (v.1.2.0)

  • #787 Add org-roam-unlinked-references
  • #783 Add support for headlines
  • #757 Roam global properties are now case-insensitive
  • #680 , #703, #708 Add org-roam-doctor checkers for ROAM_* properties
  • #664 Add support for shelling out to rg and find in org-roam--list-files
  • #679, #683 Building of the graph now happens in a separate process

Bugfixes

  • #714 No longer print citelinks in backlinks buffer if there is no ROAM_KEY property or org-ref is not installed
  • #759, #760 Tags are only added to the tags table if there are actually tags present
  • #700, #733 Allow symlinks within the org-roam directory

(docs) md-roam--extract-ref cannot differentiate org and md files

It doesn’t. i know imad to do this way as path is not passed. Need to update docs accordingly

(defun md-roam—extract-ref (original-extract-ref)
  “Extract roam_key from current buffer.
If current buffer is Org file, use ORIGINAL-EXTRACT-REF:
`org-roam—extract-ref’.
If not, use Md-roam specific regex to search within YAML front matter.
It is meant to be used with `advice-add’ :around.”

`org-roam-insert` gives an error

org-roam-insert is giving me the following error in Emacs version 27.0.91 (9.0), MacOS Catalina 10.15.5

I'm running the latest versions of both Org-Roam and MD-Roam

  md-roam--format-link("/Users/guy/0/Semantic tags.md" "Semantic tags" nil)
  apply(md-roam--format-link ("/Users/guy/0/Semantic tags.md" "Semantic tags" nil))
  org-roam--format-link("/Users/guy/0/Semantic tags.md" "Semantic tags" nil)
  org-roam-insert(nil)
  funcall-interactively(org-roam-insert nil)
  call-interactively(org-roam-insert nil nil)
  command-execute(org-roam-insert)

If it helps, here's what the installations of both Roams look like in my init.el file:

(use-package md-roam
  :straight (:host github
                   :repo "nobiot/md-roam"
                   :branch "main"))
(require 'md-roam)
(setq org-roam-file-extensions '("org" "md"))
(setq org-roam-title-sources '((mdtitle title mdheadline headline) (mdalias alias)))

;; Disable Org-roam logic in favour of Md-roam's `roam_key: bibkey` syntax
;; for performance (regex) and aethetics
(setq md-roam-use-org-extract-ref nil) ; default is t

;; Enable backlinks with using Markdown link syntax [description](path/to/file.ext)
(setq md-roam-use-markdown-file-links t) ; default is nil

;; tag support
(setq org-roam-tag-sources '(md-frontmatter))

(use-package org-roam
      :ensure t
      :hook
      (after-init . org-roam-mode)
      :custom
      (org-roam-directory "~/0")
      :bind (:map org-roam-mode-map
              (("C-c n l" . org-roam)
               ("C-c n f" . org-roam-find-file)
               ("C-c n g" . org-roam-graph-show))
              :map org-mode-map
              (("C-c n i" . org-roam-insert))
              (("C-c n I" . org-roam-insert-immediate))))

Please help. And thank you for looking out for the Markdown-using blokes.

Allow roam_alias to be a YAML formatted array

Currently this value accepts the same values as org-roam does -- a space delimited list. I'm curious whether it would be possible to format this as a regular array in the YAML frontmatter.

For example:
roam_alias: ['alias 1', 'alias 2', 'alias 3']

I'm playing around with using md-roam in the notes folder on my gatsby website. And the markdown format of md-roam is almost 100% compatible except for the roam_alias values which break when they're parsed by gatsby because they're not correctly formated YAML arrays.

(feat) Support `[[Title of a Note]]` for backlink

With Org-roam v1.2.2 (still to be released, but latest commits work), it is possible to use [[Title of a Note]] for backlinks. This should also work wiht Md-roam. I will need to investigate if there is any conflict with the current functions.

org-roam-insert is replaced with Md-roam's function to insert [[wiki-link]] where the wiki-link must be a file name without its extension.

You can manually type [[Title of a Note]] and establish a backlink (only tested casually; need a more thorough look into this).

In addition, Org-roam is working to change the syntax of [[Title of Note]] (it is one case of "fuzzy links"). I need to decide whether to implement Md-roam's own way.

md-roam --format-link during org-roam-insert

In a orfg-mode buffer (!), when I highlight some words and try to org-roam-insert I'm getting the following error.

Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 2) 3)
  md-roam--format-link("/home/[user]/Nextcloud/roam/יהודים_צפון_אפריקה.org" "יהודי צפון אפריקה" nil)
  apply(md-roam--format-link ("/home/[user]/Nextcloud/roam/יהודים_צפון_אפריקה.org" "יהודי צפון אפריקה" nil))
  org-roam--format-link("/home/[user]/Nextcloud/roam/יהודים_צפון_אפריקה.org" "יהודי צפון אפריקה" nil)
  (insert (org-roam--format-link target-file-path link-description link-type))
  (cond ((and target-file-path (file-exists-p target-file-path)) (if region-text (progn (delete-region beg end) (set-marker beg nil) (set-marker end nil))) (insert (org-roam--format-link target-file-path link-description link-type))) (t (let ((org-roam-capture--info (list (cons 'title title-with-tags) (cons 'slug (funcall org-roam-title-to-slug-function title-with-tags)))) (org-roam-capture--context 'title)) (setq org-roam-capture-additional-template-props (list :region (org-roam-shield-region beg end) :insert-at (point-marker) :link-type link-type :link-description link-description :finalize 'insert-link)) (org-roam-capture--capture))))
  (let* (region-text beg end (_ (if (region-active-p) (progn (setq beg (set-marker (make-marker) (region-beginning))) (setq end (set-marker (make-marker) (region-end))) (setq region-text (buffer-substring-no-properties beg end))))) (completions (let ((it (or completions (org-roam--get-title-path-completions)))) (if filter-fn (funcall filter-fn it) it))) (title-with-tags (org-roam-completion--completing-read "File: " completions :initial-input region-text)) (res (cdr (assoc title-with-tags completions))) (title (or (plist-get res :title) title-with-tags)) (target-file-path (plist-get res :path)) (description (or description region-text title)) (link-description (org-roam--format-link-title (if lowercase (downcase description) description) link-type))) (cond ((and target-file-path (file-exists-p target-file-path)) (if region-text (progn (delete-region beg end) (set-marker beg nil) (set-marker end nil))) (insert (org-roam--format-link target-file-path link-description link-type))) (t (let ((org-roam-capture--info (list (cons ... title-with-tags) (cons ... ...))) (org-roam-capture--context 'title)) (setq org-roam-capture-additional-template-props (list :region (org-roam-shield-region beg end) :insert-at (point-marker) :link-type link-type :link-description link-description :finalize 'insert-link)) (org-roam-capture--capture)))) res)
  (prog1 (let* (region-text beg end (_ (if (region-active-p) (progn (setq beg (set-marker ... ...)) (setq end (set-marker ... ...)) (setq region-text (buffer-substring-no-properties beg end))))) (completions (let ((it (or completions ...))) (if filter-fn (funcall filter-fn it) it))) (title-with-tags (org-roam-completion--completing-read "File: " completions :initial-input region-text)) (res (cdr (assoc title-with-tags completions))) (title (or (plist-get res :title) title-with-tags)) (target-file-path (plist-get res :path)) (description (or description region-text title)) (link-description (org-roam--format-link-title (if lowercase (downcase description) description) link-type))) (cond ((and target-file-path (file-exists-p target-file-path)) (if region-text (progn (delete-region beg end) (set-marker beg nil) (set-marker end nil))) (insert (org-roam--format-link target-file-path link-description link-type))) (t (let ((org-roam-capture--info (list ... ...)) (org-roam-capture--context 'title)) (setq org-roam-capture-additional-template-props (list :region (org-roam-shield-region beg end) :insert-at (point-marker) :link-type link-type :link-description link-description :finalize 'insert-link)) (org-roam-capture--capture)))) res) (setq --change-group-success-- t))
  (progn (activate-change-group --change-group-handle--) (prog1 (let* (region-text beg end (_ (if (region-active-p) (progn (setq beg ...) (setq end ...) (setq region-text ...)))) (completions (let ((it ...)) (if filter-fn (funcall filter-fn it) it))) (title-with-tags (org-roam-completion--completing-read "File: " completions :initial-input region-text)) (res (cdr (assoc title-with-tags completions))) (title (or (plist-get res :title) title-with-tags)) (target-file-path (plist-get res :path)) (description (or description region-text title)) (link-description (org-roam--format-link-title (if lowercase (downcase description) description) link-type))) (cond ((and target-file-path (file-exists-p target-file-path)) (if region-text (progn (delete-region beg end) (set-marker beg nil) (set-marker end nil))) (insert (org-roam--format-link target-file-path link-description link-type))) (t (let ((org-roam-capture--info ...) (org-roam-capture--context ...)) (setq org-roam-capture-additional-template-props (list :region ... :insert-at ... :link-type link-type :link-description link-description :finalize ...)) (org-roam-capture--capture)))) res) (setq --change-group-success-- t)))
  (unwind-protect (progn (activate-change-group --change-group-handle--) (prog1 (let* (region-text beg end (_ (if (region-active-p) (progn ... ... ...))) (completions (let (...) (if filter-fn ... it))) (title-with-tags (org-roam-completion--completing-read "File: " completions :initial-input region-text)) (res (cdr (assoc title-with-tags completions))) (title (or (plist-get res :title) title-with-tags)) (target-file-path (plist-get res :path)) (description (or description region-text title)) (link-description (org-roam--format-link-title (if lowercase ... description) link-type))) (cond ((and target-file-path (file-exists-p target-file-path)) (if region-text (progn ... ... ...)) (insert (org-roam--format-link target-file-path link-description link-type))) (t (let (... ...) (setq org-roam-capture-additional-template-props ...) (org-roam-capture--capture)))) res) (setq --change-group-success-- t))) (if --change-group-success-- (accept-change-group --change-group-handle--) (cancel-change-group --change-group-handle--)))
  (let ((--change-group-handle-- (prepare-change-group)) (undo-outer-limit nil) (undo-limit most-positive-fixnum) (undo-strong-limit most-positive-fixnum) (--change-group-success-- nil)) (unwind-protect (progn (activate-change-group --change-group-handle--) (prog1 (let* (region-text beg end (_ (if ... ...)) (completions (let ... ...)) (title-with-tags (org-roam-completion--completing-read "File: " completions :initial-input region-text)) (res (cdr ...)) (title (or ... title-with-tags)) (target-file-path (plist-get res :path)) (description (or description region-text title)) (link-description (org-roam--format-link-title ... link-type))) (cond ((and target-file-path ...) (if region-text ...) (insert ...)) (t (let ... ... ...))) res) (setq --change-group-success-- t))) (if --change-group-success-- (accept-change-group --change-group-handle--) (cancel-change-group --change-group-handle--))))
  (unwind-protect (let ((--change-group-handle-- (prepare-change-group)) (undo-outer-limit nil) (undo-limit most-positive-fixnum) (undo-strong-limit most-positive-fixnum) (--change-group-success-- nil)) (unwind-protect (progn (activate-change-group --change-group-handle--) (prog1 (let* (region-text beg end (_ ...) (completions ...) (title-with-tags ...) (res ...) (title ...) (target-file-path ...) (description ...) (link-description ...)) (cond (... ... ...) (t ...)) res) (setq --change-group-success-- t))) (if --change-group-success-- (accept-change-group --change-group-handle--) (cancel-change-group --change-group-handle--)))) (deactivate-mark))
  org-roam-insert(nil)
  funcall-interactively(org-roam-insert nil)
  call-interactively(org-roam-insert nil nil)
  command-execute(org-roam-insert)

I've got things set up in doom as per our previous discussion, using a local checkout of org-roam and md-roam installed from the repo.

#+BEGIN_SRC emacs-lisp :tangle packages.el
(package! md-roam
  :recipe (:host github
           :repo "nobiot/md-roam"))
#+END_SRC

#+begin_src emacs-lisp
(use-package! md-roam
:config
(setq md-roam-file-extension-single "md"
;; prefer md-roam's native bibkey syntax
md-roam-use-org-extract-ref nil
;; disable Org-roam file link for Markdown files for performance.
md-roam-use-org-file-links nil
org-roam-enable-fuzzy-links t
org-roam-auto-replace-fuzzy-links nil)
(setq org-roam-title-sources '((mdtitle title mdheadline headline) (mdalias alias))
org-roam-file-extensions '("org" "md")))
#+end_src

When md-roam is disabled things work as expected.

[FR] Please get into Melpa

It would be nice if this was already in melpa instead of a manual install so that it could be managed by straight/use-package etc.

thanks!

Support for org-roam-db-version version 18

First, thank you so much for this package. As a user of Obsidian.md, I am really looking forward to integrating this package into my workflow. Without proper support for a database, Emacs' markdown-mode is just not usable as a Zettelkasten.

I was trying to get md-roam working today, but I noticed that it only supports up to org-roam-db-version 17. Org-roam's (v2.1) current version is 18, so I was wondering if you could add support for this version as well.

Again, thank you so much for this package. The org format is much more powerful than markdown, but the lack of cross-platform support for org files (essentially, you are stuck with Emacs if you want to work properly with them) doesn't accommodate my current Zettelkasten workflow.

[FR] Changing default link style to markdown + :PROPERTIES: on new file generation

So far, kinda loving what you're doing with md-roam here, but having a few issues setting this up to move completely off of org mode documents to markdown (thank you so much for writing this btw!).

I should be clear, my goal here is to completely convert everything over to markdown and use that as the default rather than org-mode.

  1. When I use the default insert node command C-c n i the link that is inserted in my markdown document is (unfortunately) org-mode style. How does one override that?

  2. When I generate a new document with say org-roam-dailies-find-today the document inserts my markdown yaml well enough (yay!) but still inserts a :PROPERTIES: drawer with this ID at the top of the doc rather than in my yaml. How do I override that?

Anyhow thanks for the time you've spent on this. I really want to have markdown (and perhaps taskpaper) as my standard rather than org-mode docs.

(fix) Catch up to upstream commit 265182a

A good amount of cahnges have been introduced, as follows. Some of them may be already incorporated in md-roam. It's a good check list. I'll see which ones can be supported.

https://github.com/org-roam/org-roam/blob/master/CHANGELOG.md
Breaking Changes

  • #523 remove org-roam-completion-fuzzy-match in favor of using completion mechanism's configuration options directly [not relevant]]
  • #547 Deprecate org-roam-db--maybe-update, in favour of org-roam-db--update-maybe. [not relevant]
  • #547 Added type column to the refs table. [#10 ]

Features

  • #538 Optionally use text in first headline as title [#15 ]
  • #553 Add prefix argument to org-roam-db-build-cache for forcing rebuilds (not relevant)
  • #560 Apply 'error face to distinguish broken links [markdown-wiki-link-fontify-missing]
  • #570 Add org-roam-doctor to diagnose org-roam files [not relevant]

Cursor placed at the start of the last header line prevents use of templates

When a new note is created, the cursor is placed at the beginning of the line with the last entry in the YAML header. With the default config for a template markdown note, which in my Doom setup looks like

(setq org-roam-capture-templates
      '(("d" "default" plain
         ""
         :target (file+head "${slug}.md"
                            "---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: #draft\n---\n")
         :immediate-finish t
         :unnarrowed t)))

the new note is opened like this:

Screen Shot 2022-07-07 at 21 02 12

When I try to use a template instead of an empty string either using a single string

(setq org-roam-capture-templates
      '(("d" "default" plain
         "- `Relevant notes`\n\n# ${title}\n\n%?\n\n*Reference (Author, Date)*"
         :target (file+head "${slug}.md"
                            "---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: #draft\n---\n")
         :immediate-finish t
         :unnarrowed t)))

or a template file with the same content as that string

(setq org-roam-capture-templates
      '(("d" "default" plain
         (file "~/Documents/Slip-box/Templates/Zettel.md") 
         :target (file+head "${slug}.md"
                            "---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: #draft\n---\n")
         :immediate-finish t
         :unnarrowed t)))

the content is inserted at this cursor position like this:

Screen Shot 2022-07-07 at 20 31 37

Note how within this incorrectly inserted template the cursor is positioned as expected at the %?.

With plain org-roam templates defined like this work fine. Sorry if this is a misconfiguration on my part, I am very new to Emacs.

Question: Could you provide a basic tutorial on how to create an .md note and link to it?

I installed this plugin on Doom Emacs as instructed and reloaded it.

When i use 'Org Roam Capture' command(space+n+r+c) an .org file is created instead of .md file. When I try to create an .md note manually it doesn't get registered by org roam(space+n+r+r). I can't link to it using 'Org Roam insert'(space+n+r+i) from other .md notes because i can't see the newly crated one after using the command.

my config.el:

(use-package! md-roam 
  :config
  (setq md-roam-file-extension-single "md")
  (setq org-roam-title-sources '((mdtitle title mdheadline headline) (mdalias alias))))

my package.el:

(package! md-roam
  :recipe (:host gitlab
           :repo "nobiot/md-roam"))

File Names or Titles with spaces break md-roam

I was having trouble getting my the org-roam.db file to build correctly in my folder full of only markdown files. I would run org-roam-db-build-cache but whenever I used org-roam-find-file no files would show up. Eventually I tried renaming all my markdown files so that they no longer had spaces in the file, replacing it with -. After doing that I was able to run org-roam-db-build-cache correctly; however I noticed that the org-roam backlinks didn't show up for notes that had titles in them.

For example: I have a note whose title is website. The backlinks show up fine when I have that file open. I also have a note whose title is website redesign. These notes both link each other but the backlinks only show up in the note with a title and not in the note with a space in the title. This seems to be true across all of my markdown notes. The ones with spaces don't have backlinks, the ones without spaces display their backlinks.

[doom] load order

Hi there!

How can I guarantee the load order in doom? Should I require md-roam in org-roam's after! Or use-package! call? I'm using the +roam flag and installing md-roam as per your instructions but I can't create md files nor see existing one in the default org-roam-directory.

(feat) Support "lite" syntax for aliases

This is the current syntax to define aliases. Compliant with YAML syntax, and works great.

 roam_alias: [ alias 1, 'alias 2', "alias 3" ]

I feel that I would like to have an option to also support

roam_alise: alias 1, alise 2

and/or

aliases: [alias 1, alias 2]

The latter is compatible with gatsby-themes-brain

Let's how far this idea can be implemented.

org-roam-node-insert with new note

Hi,

when I use org-roam-node-insert and type a new name to create a new note, after closing the capture buffer with C-c C-c, md-roam inserts an org-roam like link [[id:...][new note]].

Any ideas to fix this to insert the md-like link without id ?

Greetings

Test upstream update b2594b8..81e7a5b (2020-06-06)

I can observe some changes around the treatment of #+ROAM_xx properties (such as #+ROAM_ALIAS), and related functions.

Examples:

This might be also an interesting one to test (I have never had a problem, but it might be good to see if something like roam_alias: "malformed value(note the missing closing"`) causes an error in db cache build.

In addition, this should not affect me as I explicitly define elisp for the variable. Windows might be more susceptible if any influence at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.