GithubHelp home page GithubHelp logo

obsidian.el's People

Contributors

citizen428 avatar gabriel-francischini 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

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.

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.

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?

`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)))

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).

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

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.

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.

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)"

[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

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

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,

Caching for obsidian-update

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

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!

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.

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:]_/-]*"

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?

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

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.

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!

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!

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?

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?

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.

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.

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.

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.

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!

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.

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.