Coder Social home page Coder Social logo

obsidian.el's Introduction

Obsidian Notes for Emacs

https://melpa.org/packages/obsidian-badge.svg https://stable.melpa.org/packages/obsidian-badge.svg

Emacs front-end for Obsidian Notes.

Table of Contents

Installation

Obsidian.el is available from MELPA or MELPA Stable and can be installed with:

M-x package-install RET obsidian RET

Put this in your init.el:

(require 'obsidian)
(obsidian-specify-path "~/MY_OBSIDIAN_FOLDER")
;; If you want a different directory of `obsidian-capture':
(setq obsidian-inbox-directory "Inbox")
;; Clicking on a wiki link referring a non-existing file the file can be
;; created in the inbox (t) or next to the file with the link (nil).
;; Default: t - creating in the inbox
;(setq obsidian-wiki-link-create-file-in-inbox nil)
;; You may want to define a folder for daily notes. By default it is the inbox.
;(setq obsidian-daily-notes-directory "Daily Notes")
;; Directory of note templates, unset (nil) by default
;(setq obsidian-templates-directory "Templates")
;; Daily Note template name - requires a template directory. Default: Daily Note Template.md
;(setq obsidian-daily-note-template "Daily Note Template.md")


;; Define obsidian-mode bindings
(add-hook
 'obsidian-mode-hook
 (lambda ()
   ;; Replace standard command with Obsidian.el's in obsidian vault:
   (local-set-key (kbd "C-c C-o") 'obsidian-follow-link-at-point)

   ;; Use either `obsidian-insert-wikilink' or `obsidian-insert-link':
   (local-set-key (kbd "C-c C-l") 'obsidian-insert-wikilink)

   ;; Following backlinks
   (local-set-key (kbd "C-c C-b") 'obsidian-backlink-jump)))

;; Optionally you can also bind a few functions:
;; replace "YOUR_BINDING" with the key of your choice:
(global-set-key (kbd "YOUR_BINDING") 'obsidian-jump)       ;; Opening a note
(global-set-key (kbd "YOUR_BINDING") 'obsidian-capture)    ;; Capturing a new note in the inbox
(global-set-key (kbd "YOUR_BINDING") 'obsidian-daily-note) ;; Creating daily note

;; Activate detection of Obsidian vault
(global-obsidian-mode t)

Or using use-package:

(use-package obsidian
  :ensure t
  :demand t
  :config
  (obsidian-specify-path "~/MY_OBSIDIAN_FOLDER")
  (global-obsidian-mode t)
  :custom
  ;; This directory will be used for `obsidian-capture' if set.
  (obsidian-inbox-directory "Inbox")
  ;; Create missing files in inbox? - when clicking on a wiki link
  ;; t: in inbox, nil: next to the file with the link
  ;; default: t
  ;(obsidian-wiki-link-create-file-in-inbox nil)
  ;; The directory for daily notes (file name is YYYY-MM-DD.md)
  (obsidian-daily-notes-directory "Daily Notes")
  ;; Directory of note templates, unset (nil) by default
  ;(obsidian-templates-directory "Templates")
  ;; Daily Note template name - requires a template directory. Default: Daily Note Template.md
  ;(obsidian-daily-note-template "Daily Note Template.md")
  :bind (:map obsidian-mode-map
  ;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding.
  ("C-c C-o" . obsidian-follow-link-at-point)
  ;; Jump to backlinks
  ("C-c C-b" . obsidian-backlink-jump)
  ;; If you prefer you can use `obsidian-insert-link'
  ("C-c C-l" . obsidian-insert-wikilink)))

Optionally you can specify obsidian-inbox-directory, it will be used by obsidian-capture to store new notes into. If you don’t set it the root folder of your Obsidian vault will be used.

About Obsidian.el

I wanted to work with Obsidian Notes using Emacs. Obviously you already can open your Obsidian folder and start editing markdown files with Emacs. But I want to improve that and split the responsibilities between Emacs and Obsidian the way it makes sense for an Emacs user.

What should we keep doing in Obsidian?

  • Sync
  • Mobile client (of course, and that’s where Obsidian beats anything else in Emacs)
  • Complex exploring (graph views etc)
  • All the things done with complex plugins

What should be possible to do in Emacs?

Obsidian.el must empower us to stay in Emacs for things that make sense in Emacs:

  • [X] Creating and editing notes with convenient autocomplete for tags and links (nothing will ever compare to Emacs in terms of editing power)
  • [X] Jumping between notes
  • [X] Searching all notes
  • [X] Finding all notes with a tag
  • [X] Following backlinks
  • [ ] Viewing backlinks in a separate list

When all of the above is ready we will almost never need the Obsidian app on desktop, but will still be able to use it on mobile or when specifically needed.

How does obsidian.el work?

obsidian-mode

When you require obsidian.el via use-package or in other ways (see snippet above), you have to specify the root folder of your Obsidian Notes vault. If global-obsidian-mode is enabled and if you specified the root folder, each time you open a markdown buffer it checks, if that file is part of your Obsidian Notes vault. If it is obsidian-mode minor mode is activated for this buffer.

company-mode completion

./resources/tag-completion.png

Once the obsidian-mode is activated obsidian.el scans all markdown files in the vault for tags and links (links still WIP), and stores these lists in it’s global variables. It also adds company-mode backends to suggest links and tags for completion.

Hydra menu

When Hydra is installed, obsidian-hydra will be defined such that it can be used for bindings:

(bind-key (kbd "C-c M-o") 'obsidian-hydra/body 'obsidian-mode-map)

./resources/hydra-menu.png

Including hidden dot files

Obsidian does not track hidden files; obsidian.el can be configured to either track them or ignore them by setting the value of `obsidian-include-hidden-files`.

Manual re-scan

You can update the lists of tags, links etc. manually if it’s lagging for some reason by running an interactive command:

M-x obsidian-update RET

Following links

Obsidian.el implements a custom command obsidian-follow-link-at-point which correctly follows markdown and wiki links generated by the Obsidian App. In the install example above this command is bound to C-c C-o in obsidian-mode.

M-x obsidian-follow-link-at-point RET

Note that the Obsidian app replaces spaces with %20 when inserting markdown links, and doesn’t do that when inserting wiki links. Obsidian.el follows this convention to maximize compatibility:

Markdown link with spaces: [2-sub with spaces and буквы](subdir/2-sub%20with%20spaces%20and%20буквы.md)

Wikilink with spaces: [[Subdir/2-sub with spaces and буквы]]

Both these types of links are correctly handled by obsidian-follow-link-at-point.

Following backlinks

You can quickly jump to backlinks to current file using obsidian-backlink-jump

M-x obsidian-backlink-jump RET

Multiple matches

Obsidian doesn’t insert relative path by default, only does it when there are multiple files with the same name. obsidian-follow-link-at-point handles this correctly. Every time you follow a link it checks, if there’s only one match for the filename linked. If there’s just one it simply opens that file. If there’s more than one it prompts you to select which file to open.

Inserting links

./resources/insert-link.png

When inserting links, two different formats can be used to specify the file: the filename alone, or the path to the file within the Obsidian vault. The default is to only use the filename, but this behavior can be changed by setting the variable obsidian-links-use-vault-path to t. Alternately, using the prefix argument before the call to insert a link will toggle this behavior, inserting a link with the format opposite of this variable.

There are two commands to insert links obsidian-insert-link and obsidian-insert-wikilink, you can choose one depending on your preferred link format:

Inserts a link in Markdown format

Example: [Link description](path/to/file.md)

M-x obsidian-insert-link RET

Note, that when you insert a link to file that has spaces in it’s name, like “facts about inserting links.md”, Obsidian app would html-format the spaces, meaning the link will look like

[facts](facts%20about%20inserting%20links.md)

Obsidian.el follows this convention and does the same when inserting markdown links. obsidian-follow-link-at-point handles this correctly.

Insert a link in wikilink format

Example: [[path/fo/file.md|Link description]]

M-x obsidian-insert-wikilink RET

Jumping between notes

Quickly jump between notes using obsidian-jump

M-x obsidian-jump RET

Aliases

If you have YAML front matter in your note, Obsidian.el will find aliases in it and add them to the obsidian-jump selection. Both aliases and alias keys are supported.

Capturing new note

Use obsidian-capture. If you specified obsidian-inbox-directory, it will create new notes in this directory. Otherwise in your Obsidian vault root directory:

M-x obsidian-capture RET

Searching notes

Use obsidian-search to look for a string or a regular expression:

M-x obsidian-search RET query RET

Finding all notes with a tag

Use obsidian-tag-find to list all notes that contain a tag. Let’s you choose a tag from list of all tags:

M-x obsidian-tag-find RET

Move note to another folder

Use obsidian-move-file to move current note to another folder:

M-x obsidian-move-file RET

Templates

Obsidian.el has a basic template support, where the Obsidian app’s template placeholders can be used, without customization. {{title}}, {{date}}, and {{time}} can be used. {{title}} is the name of the file without the extension.

Development tasks

  • [X] Specify Obsidian folder and save it in variables
  • [X] Enumerate files in the Obsidian folder and save a list
  • [X] Run the scan when entering obsidian-mode
  • [X] Functions to scan notes for tags
  • [X] Get full list of all tags
  • [X] company-backend with tags
  • [X] commands to insert links in markdown and wikilink
  • [X] Capture command to create a new note in Obsidian folder
  • [X] Obsidian minor for matching .md files
  • [X] Jumping between notes
  • [X] Following links
  • [X] Following backlinks

Why obsidian.el and not…

Obsidian App itself, Athens Research or any other great app?

Easy. When on desktop they are simply not Emacs. Not even Obsidian itself. Emacs beats anything else for things that it is built for. But you know this already, otherwise you wouldn’t be here.

Org-roam or any other great Emacs libraries?

The answer is mostly the same for all of them. Mobile support. Or rather — NO mobile support. I don’t buy into the story that “you don’t really need your PKM system on mobile”, and “serious work is done only on desktop” etc. These are just excuses for the impossibility of building a full-fledged mobile version of Emacs.

So there were two ways to go about it: build a mobile app for something like org-roam (which would be cool, but is above my front-end skills) or build a light-weight Emacs client for something like Obsidian. I chose the simpler task.

Versioning

The project uses break versioning, meaning that upgrading from 1.0.x to 1.0.y will always be safe, upgrading from 1.x.x to 1.y.x might break something small, and upgrade from x.x.x to y.x.x will break almost everything.

Contributing

PRs and issues are very welcome. In order to develop locally you need to install eldev. After that you can run make commands, in particular make test and make lint to make sure that your code will pass all MELPA checks.

Gratitude

  • The work on Obsidian.el was made considerably easier and definitely more fun thanks to the great work of Magnar Sveen and his packages dash.el and s.el. Thank you for making Elisp almost as convenient as Clojure!
  • During the development of Obsidian.el I have learned and copied from the code of the amazing org-roam package. Thank you!

obsidian.el's People

Contributors

citizen428 avatar gabriel-francischini avatar hoke-t avatar hrehfeld avatar jayemar avatar john-goff avatar kdmsnr avatar knu avatar krydos avatar la-toth avatar licht1stein avatar mastro35 avatar netromdk 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

obsidian.el's Issues

add backlinks

obsidian.el has changed my life, it is a really great piece of software, thanks!
However, it would be even better if you could see which backlinks are referring a specific node.

Package uses f.el without declaring the dependency, I think

I haven't looked deeply into the code, but I just did a fresh install of obsidian.el from MELPA. Following a wikilink to an not-yet-existing file (one of the first things I tried) failed because it couldn't find f-mkdir-full-path, a function from f.el.

I did not have f.el installed; after installing it from MELPA things worked fine.

obsidian-inbox-directory should be used when visiting links that don't yet exist

When visiting a link for a file, if the file does not yet exist, obsidian.el will create a new file for that link. However, the new file will be created in the vault's root directory even if obsidian-inbox-directory is set. To better align with the functionality of Obsidian, if obsidian-inbox-directory is set, these new files should be placed there instead of in the vault root.

Default directory for creating new files

It's great that obsidian-follow-link-at-point creates a new file when it does not exists (like obsidian). Now we're creating notes in the obsidian-specify-path directory, i would like to set a default directory for creating new notes: in my case it would be $OBSIDIAN_ROOT/Inbox.
Can this package be configured to achieve that behavior and if not is it something that can be added?
Thank you!

Backlinks doesn't follow with paths incompletes.

I have the following file structure

zettelkasten/
├─ mocs/
│  ├─ moc_test.md
├─ index.md

index.md:

[[moc_test]]

when i use obsidian-follow-link-at-point on index.md to go to moc_test.md, it creates a new file on zettelkasten folder, instead go to mocs/moc_test.md

when i change
index.md:

[[moc_test]]

to
index.md:

[[mocs/moc_test]]

it works, but..

What if at some point, I decide to change my file location, will I have to update the path of this file everywhere?

invalid yaml causes obsidian-jump to break

I probably have some invalid yaml somewhere in my obsidian notes directory.
This is causing obsidian-jump to fail with the below error:

Obsidian tags updated
yaml-parse-string: Unable to parse YAML.  Parser finished before end of input 26/63

Ideally, invali yaml somewhere should not cause the entire command to break.

Slow performance when opening files or invoking functions

Love the idea of this package!

I have about 5000 files and I'm seeing a delay of a few seconds whenever I open a file in my Obsidian path, or callobsidian-jump, obsidian-backlink-jump, etc. I'm using a pretty much out of box Doom config. Files within my obsidian directory open quickly when obsidian.el isn't configured.

Is this expected? Anything I can do to help debug?

Following a wiki link a new file is created if the link refers a section

In Obisidan I can link any section of a file by using the [[filename#header-title]] format.
In obsidian.el it doesn't jump to the filename.md file (or preferably to the actual header, instead it creates a new file with the name filename#header-title.md.

Furthermore, it creates the file in the inbox folder instead of the folder containing the original file - I can configure it in Obsidian.
Typically, it's good if a freshly created note is saved into the inbox, but it's also common if a non-existing linked file is created next to the original file (that contains the link).

I think obsidian-find-file could split the filename at the # characters and keep only the first part.

`obsidian-follow-link-at-point` wrongly converts ASCII apostrophes to Unicode right single quotation mark

This obsidian link behaves differently between Obsidian and obsidian-mode's obsidian-follow-link-at-point:

[[bushnell's law|pequeno número de regras mas ainda assim interessantes]]

In Obsidian, it would open the file bushnell's law.md however obsidian-follow-link-at-point interprets it as a link to bushnell’s law.md.

The only difference is between the apostrophes, vs ':

Printable Hexcode Unicode Point Unicode Character
' 27 U+0027 APOSTROPHE
e2 80 99 U+2019 RIGHT SINGLE QUOTATION MARK

Here's the obsidian note with the link that causes this issue. The linked note was created inside Obsidian by double-clicking on its link and only later the link was opened on emacs through obsidian-follow-link-at-point, which opened a blank buffer. That blank buffer was named bushnell’s law.md (with the U+2019), hinting that it might have been created due to bushnell’s law.md (the U+2019 one) not existing even though bushnell's law.md (the U+0027 one) already existed. I had ran obsidian-update before opening any notes (or my vault) inside emacs.

Both notes were written in Portuguese with Obsidian configured as English, but that shouldn't cause this bug.

Other ASCII characters or Unicode points may also be affected by this bug.

Here are all notes involved, in case you want to inspect their contents:

Filename Role
chess is the drosophila of ai.md Original note
bushnell's law.md Linked note
bushnell’s law.md Blank note

Here's my obsidian-mode configuration if it helps, copied straight out of the README.org:

(use-package obsidian
  :ensure t
  :demand t
  :config
  (obsidian-specify-path "/mnt/p/pCloud-TCC/Obsidian Vault/TCC")
  (global-obsidian-mode t)
  ;; :custom
  ;; ;; This directory will be used for `obsidian-capture' if set.
  ;; (obsidian-inbox-directory "Inbox")
  :bind
  (:map obsidian-mode-map
        ;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding.
        ("C-c C-o" . obsidian-follow-link-at-point)
        ;; Jump to backlinks
        ("C-c C-b" . obsidian-backlink-jump)
        ;; If you prefer you can use `obsidian-insert-link'
        ("C-c C-l" . obsidian-insert-wikilink)))

Cannot find existing markdown files outside inbox

While I worked on issue #70, I tried to figure out why it can't find the existing markdown file with or without my changes.

The obsidian-find-file tries to match the file from all-files coming from the cache, but fails on this line:

  (matches (obsidian--match-files f all-files))

And that was the strangely working function:

(defun obsidian--file-relative-name (f)
  "Take file name F and return relative path for `obsidian-directory'."
  (message "f   %s" f)
  (message "od  %s" obsidian-directory)
  (message "frn %s" (file-relative-name f obsidian-directory))
  (file-relative-name f obsidian-directory))

What I expected is to have a generic idea what should be shown for the actually matching file, but strangely it thinks that the file is in the inbox folder. Visiting a wiki link the code iterates on all files, so for instance the moc.md in the MY_OBSIDIAN_FOLDER produces:

f   moc.md
od  /home/user/MY_OBSIDIAN_FOLDER
frn 000 Inbox/moc.md

The reason behind that is the behavior of file-relative-name. If the first parameter, f is a relative path, like in my case, it prefixes with the current directory (based on my reproduction in **scratch** buffer), so if the current directory is the inbox, the actual filename will be /home/user/MY_OBSIDIAN_FOLDER/000 Inbox/moc.md instead of /home/user/MY_OBSIDIAN_FOLDER/moc.md, this is why the result is useless. And obviously if the file is already in the inbox, like, e.g. 000 Inbox/my-idea.md, the result is 000 Inbox/000 Inbox/moc.md.

So this function should not be called here.

Slows down Emacs when doing `obsidian-follow-link-at-point` and sometimes create new file while the file already exists in Obsidian Vault.

I have these files in Obsidian Vault:

status

主题/文件对比.md
callout_test.md
test.md

What's in test.md

[[文件对比]]

What's in 文件对比.md

[[test]]

problem

When I was in test.md, obsidian-follow-link-at-point creates a new file under Vault instead goto 主题/文件对比.md.
When I was in 主题/文件对比.md, obsidian-follow-link-at-point list two option in minibuffer:

callout_test.md
test.md

Instead of goto test.md.

Similar to what this PR mentions:

#32

YAML in Templater files can't be parsed

Hi,

I use the popular Templater plugin to insert a link to today's daily note every time I make a new note. The template file looks like:

---
Links:
  - "[[<% tp.date.now("YYYY-MM-DD") %>]]"
---

This throws an error "Unable to parse YAML." from yaml-parse-string when calling a variety of functions.

Perhaps a simple fix is to be able to specify files to be ignored by obsidian.el?

Thanks!

Please don't depend on Company

Your package depends on Company. But there are other completion UIs like Corfu, Auto Complete, and obviously the minibuffer. Please don't depend on Company. I don't think it is necessary to depend on Company just because you define a Company backend, because there is a package named Cape which can convert Company backend function to CAPF (Completion at point function), allowing other completion UIs to use the completion function.

Here is the patch: (I tried to create a pull request, but failed to push to my fork)

From c22227a8d7946b966eb3161cfa2a7a78bf7db215 Mon Sep 17 00:00:00 2001
From: Akib Azmain Turja <[email protected]>
Date: Tue, 9 Aug 2022 22:44:43 +0600
Subject: [PATCH] Don't depend on Company

---
 obsidian.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/obsidian.el b/obsidian.el
index 91b56ca..330a858 100644
--- a/obsidian.el
+++ b/obsidian.el
@@ -40,7 +40,7 @@
 (require 's)
 
 (require 'cl-lib)
-(require 'company)
+(require 'company nil t)
 
 (require 'org)
 (require 'markdown-mode)
@@ -234,7 +234,10 @@ Optional argument IGNORED this is ignored."
   (interactive (list 'interactive))
 
   (cl-case command
-    (interactive (company-begin-backend 'obsidian-tags-backend))
+    (interactive (if (and (featurep 'company)
+                          (fboundp 'company-begin-backend))
+                     (company-begin-backend 'obsidian-tags-backend)
+                   (error "Company not installed")))
     (prefix (when (and
 		   (-contains-p local-minor-modes 'obsidian-mode)
 		   (looking-back obsidian--tag-regex nil))
@@ -413,7 +416,8 @@ See `markdown-follow-link-at-point' and
 ;;;###autoload
 (define-globalized-minor-mode global-obsidian-mode obsidian-mode obsidian-enable-minor-mode)
 
-(add-to-list 'company-backends 'obsidian-tags-backend)
+(when (boundp 'company-backends)
+  (add-to-list 'company-backends 'obsidian-tags-backend))
 
 ;; (obsidian-comment
 ;;  (use-package obsidian
-- 
2.37.1

Caching for obsidian-update

It might be beneficial to cache the results of obsidian-update. I might tackle this when I find some time.

follow-link-at-point can't follow some wikilinks in incomplete tasks

I get an error trying to use obsidian-follow-link-at-point to follow wikilinks when they're in an incomplete task that begins with a link, like this:

- [ ] [[some project page]]

I get this error: Wrong type argument: arrayp, nil.

However, links like this work fine:

- [ ] go do [[some project]]

Appending words to the first example doesn't fix the problem.
Note that obsidian-follow-wiki-link-at-point actually still works.

I'm running emacs 28.2 (in particular obsidian-nox on ubuntu 23.04), I got obsidian.el from MELPA.

Multi-vault support

Hello

Obsidian can open multiple vaults. But obsidian-mode can treat only one vault
that is specified by obsidian-specify-path in the init.el.

I can make use of obsidian-* functions for multiple vaults after I run M-x obsidian-specify-path manually.
But it would be convenient if it is done automatically. I mean that when I am editing some markdowns of vault A,
M-x obsidian-* are applied to vault A. And if I am editing some
markdowns of vault B, M-x obsidian-* are applied to vault B.

I'm not sure this is a feasible feature. But it would be great if I can opt in/out this feature as I want.

Thanks,

obsidian-follow-link-at-point shouldn't offer a multiple selections of files with the same suffix searched

Hi, I think I found a bug.

In my vault I have two files named aaa.md and not-the-aaa.md.
If in a third file called xxx.md I put a link to [aaa](aaa.md) and I follow it with obsidian-follow-link-at-point, I am not redirected to aaa.md but I'm promped so to choose which file to follow because I have two files with the same suffix aaa.md in my directory.

I think this shouldn't happen, a link should bring me to a specific file.

I think this happens because of this function:

(defun obsidian--match-files (f all-files)
  "Filter ALL-FILES to return list with same name as F."
  (-filter (lambda (el) (s-ends-with-p f el)) all-files))

that match the files using the suffix, while it should probably use the full file name like this:

(defun obsidian--match-files (f all-files)
  "Filter ALL-FILES to return list with same name as F."
  (-filter (lambda (el) (s-equals-p f (obsidian--file-relative-name el))) all-files))

What do you think about it?

obsidian-insert-link can break non-obsidian links

When calling obsidian-insert-link with a non-Obsidian link such as file:// or https://, returned link may be invalid.

The link passed to obsidian-insert-link may get passed to file-name-directory which will parse the link on slashes, only returning the portion that follows the final slash (/).

For example:

(file-name-nondirectory "https://en.wikipedia.org")
=> www.wikipedia.org
(file-name-nondirectory "https://en.wikipedia.org/wiki/Guitar_Songs")
=> Guitar_Songs

add templates support

Obsidian has templates, it would be nice in obsidian.el, too

I have an implementation for daily note templates here

This commit is not perfect, after visiting the daily note the second time the buffer-size is void. I must fix that part.

Allow for custom note titles on obsidian-capture

Obsidian.nvim has this feature where you're able to change the note name (specifically the file name) when creating:

    -- Optional, customize how names/IDs for new notes are created.
    note_id_func = function(title)
      -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
      -- In this case a note with the title 'My new note' will given an ID that looks
      -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
      local suffix = ""
      if title ~= nil then
        -- If title is given, transform it into valid file name.
        suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
      else
        -- If title is nil, just add 4 random uppercase letters to the suffix.
        for _ = 1, 4 do
          suffix = suffix .. string.char(math.random(65, 90))
        end
      end
      return tostring(os.time()) .. "-" .. suffix
    end,

(here a note called Hello World would be converted to 202307061244-hello-world.md)

I know that slipbox isn't the most popular style of naming, but I've come to love it myself.

I was wondering if this would be a reasonable addition to your package. I don't have a lot of experience with lisp, but I'm willing to give this addition a shot if you think that it's worth doing (and possible/reasonably implemented in emacs).

Exclude .obsidian dir

When I use obsidian-search etc., it finds Markdown files under the .obsidian directory (for example, .obsidian/plugins/README.md). I would like to exclude .obsidian dir.

[bind-key]How to use obsidian.el in Emacs 29? Thank you very much.

Emacs Version 29.0.50 (9.0)

obsidian.el: 20221102.1643

when install obsidian.el and put config to init.el then eval-buffer:

;; obsidian.el
(require 'obsidian)
(obsidian-specify-path "~/Documents/GitHub/Chaos")
;; If you want a different directory of `obsidian-capture':
(setq obsidian-inbox-directory "Inbox")

;; Replace standard command with Obsidian.el's in obsidian vault:
(bind-key (kbd "C-c C-o") 'obsidian-follow-link-at-point 'obsidian-mode-map)

;; Use either `obsidian-insert-wikilink' or `obsidian-insert-link':
(bind-key (kbd "C-c C-l") 'obsidian-insert-wikilink 'obsidian-mode-map)

;; Following backlinks
(bind-key (kbd "C-c C-b") 'obsidian-backlink-jump 'obsidian-mode-map)


;; Optionally you can also bind `obsidian-jump' and `obsidian-capture'
;; replace "YOUR_BINDING" with the key of your choice:
; (bind-key (kbd "YOUR_BINDING") 'obsidian-jump)
; (bind-key (kbd "YOUR_BINDING") 'obsidian-capture)

;; Activate detectino of Obsidian vault
(global-obsidian-mode t)

Emacs notifies: symbol's function definition is void: bind-key

Preview inline images with wikilinks

emacs's markdown-mode can display images when the function markdown-toggle-inline-images is run. This only works for images that use the markdown image format, but not the wikilink format that Obsidian may use.

This would be a nice feature to add to make working with Obsidian notes in emacs even nicer.

Tag format doesn't match that of Obsidian

From the Obsidian page on tag:

You can use any of the following characters in your tags:

Alphabetical letters
Numbers
Underscore (_)
Hyphen (-)
Forward slash (/) for [Nested tags](https://help.obsidian.md/Editing+and+formatting/Tags#Nested%20tags)

Tags must contain at least one non-numerical character. For example, #1984 isn't a valid tag, but #y1984 is.

Tags can't contain blank spaces.

obsidian.el currently allows plus sign, as well as numerical-only tags, neither of which are valid Obsidian tags.

Ideally, the obsidian--tag-regex could be updated to match that of Obsidan. The regex below comes close, but it will also extract tags from the middle of a string which I do not believe are valid Obsidian tags. (For example, it will extract #bar from foo#bar and treat it like a tag.)

"#[[:alnum:]_/-]*[[:alpha:]_/-]+[[:alnum:]_/-]*"

Alias front matter support

First of all: awesome package!

I use alias front matters to define aliases in my Obsidian notes.
For instance, my home "+Home.md" has the following at the top:

---
aliases: [000, Home, Beginning]
---

It would be great if obsidian-jump would show 000, Home, and Beginning in addition to +Home in the list.

Thanks!

are multiple capture templates possible?

This is more of a question around enhancements than an issue, but I was wondering if it was possible to have multiple capture destinations and capture templates for each - something closer to org's flexible capture templates.

I use obsidian.el every day - but currently have to dump lots of "types" of notes into my root directory and then manually refile them to target folders. It would be great to do this type of refiling at note origination time.

Thanks for creating this, it really is wonderful.

Intended functionality of obisidan-capture and obsidian-move-file

When using obisidian.el, a common workflow for me is to use obsidian-capture to create a new note. This note will be placed in the directory specified by obsidian-inbox-directory, so I'll often want to move that to a different location for which I use obsidian-move-file. But I have a couple of questions about this workflow.

After I create the new note using obsidian-capture, it is not available via obsidian-insert-link unless I restart emacs. I've tried running obsidian-update to see if that would allow the new file to be seen by obsidian-insert-link, but it doesn't. Is this the intended behavior, or should the new note be available for linking as soon as it is created? If so, do I need to change my workflow somehow in order to allow for this functionality?

I often don't want files to live in the obsidian-inbox-directory so I'll eventually move them to somewhere more permanent. However, I may have already linked to them before I move them. So I was wondering if the obsidian-move-file function does anything special to update links in other files that link to the file being moved, or should I be moving files to their final location before creating links to them to avoid breaking links?

I hope this is the proper forum for these questions. Thanks for the great work and the great tool!

how to find markdown-mode-2.6 (which seems required for installation of obsidian.el)?

When I try to install the obsidian package, I get the following error:

Need package 'markdown-mode-2.6` but only 2.5 is available

I don't understand how to find markdown-mode-2.6 -- the latest stable version is 2.5 from what I can see (https://github.com/jrblevin/markdown-mode/releases -- https://web.archive.org/web/20221001162717/https://github.com/jrblevin/markdown-mode/releases)

What can I do to get markdown-mode-2.6?

mapcar: Wrong type argument: sequencep, 108

obsidian-update and obsidian-jump return "mapcar: Wrong type argument: sequencep, 108"

obsidian.el
Version: 20231211.1857
Commit: 56f6861
Summary: Obsidian Notes interface

GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-07-30

PS: Previous version obsidian.el worked fine

Update: On note opening returning "File mode specification error: (wrong-type-argument sequencep 108)"

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.