Skip to content

Add text/uri-list support for paste_img #829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 54 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
5c990f0
refactor: move nvim-cmp sources from root
adamtajti Jan 24, 2025
5c14b9a
blink support
adamtajti Jan 27, 2025
a8d8d54
docs
adamtajti Jan 27, 2025
658f548
linter care
adamtajti Jan 27, 2025
726bf89
implementing snack picker
SjB Feb 9, 2025
d6490d5
added documentation
SjB Feb 12, 2025
1e1c912
refactor(pickers): improve snacks picker implementation and callback …
SjB Feb 13, 2025
62c546a
refactor(pickers): improve snacks picker implementation and error han…
SjB Feb 14, 2025
f7ba7ae
fix: correct Path handling in grep picker
SjB Feb 14, 2025
2fe5fad
Changed the name of the linux binary in github actions
guspix Feb 28, 2025
ea293e8
Changed the name of the github binary for the docs action
guspix Feb 28, 2025
666195d
Merge pull request #1 from obsidian-nvim/bugfix/github-actions-neovim…
guspix Feb 28, 2025
ee7943e
Trying to fix github actions when merging to main
guspix Feb 28, 2025
e5d5db3
Merge pull request #2 from obsidian-nvim/bugfix/github-actions-neovim…
guspix Feb 28, 2025
90bbcaf
Revert "Trying to fix github actions when merging to main"
guspix Feb 28, 2025
a9beb92
Merge pull request #3 from obsidian-nvim/bugfix/github-actions-neovim…
guspix Feb 28, 2025
dbd6529
chore(docs): auto generate docs
guspix Feb 28, 2025
abe7987
Fixing linting, formatting and CHANGELOG for github actions
guspix Mar 1, 2025
a78fb6d
Merge pull request #5 from obsidian-nvim/blink-support
guspix Mar 2, 2025
e0c781e
chore(docs): auto generate docs
guspix Mar 2, 2025
d66b1f0
Merge branch 'main' into snacks-picker
guspix Mar 2, 2025
6a25311
Merge pull request #4 from obsidian-nvim/snacks-picker
guspix Mar 2, 2025
2cbf2ea
chore(docs): auto generate docs
guspix Mar 2, 2025
843aefe
Changed README to point to the org's repos and releases
guspix Mar 3, 2025
0d9111f
Changed changelog script to reference the org's repo + epwalsh dir in…
guspix Mar 3, 2025
4fca65b
Merge pull request #9 from obsidian-nvim/chore/update-docs-from-epwalsh
guspix Mar 3, 2025
9a3bfd3
chore(docs): auto generate docs
guspix Mar 3, 2025
8fc0dbf
Changed changelog reference to epwalsh
guspix Mar 3, 2025
bacd8b2
Merge pull request #12 from obsidian-nvim/chore/update-docs-from-epwalsh
guspix Mar 3, 2025
a954102
doc: add instruction for rocks.nvim, warning for packer.nvim
neo451 Mar 4, 2025
b5a15a3
fix: offload markdown rendering to render-markdown/markview
neo451 Mar 4, 2025
39ff5a0
update CHANGELOG
neo451 Mar 4, 2025
4c2f1ce
Fix bug where ObsidianNewFromTemplate does not respect note_id_func
bosvik Mar 6, 2025
da01374
Merge pull request #14 from neo451/main
guspix Mar 6, 2025
87d7b4e
chore(docs): auto generate docs
guspix Mar 6, 2025
624dab4
Merge pull request #16 from bosvik/main
neo451 Mar 6, 2025
e6ca9e8
feat: explain the fork in readme
ffricken Mar 6, 2025
405e35f
Merge pull request #18 from ffricken/chore/readme-about-the-fork
guspix Mar 8, 2025
5b3cbe2
chore(docs): auto generate docs
guspix Mar 8, 2025
5eea5d2
fix: parser treats "Nan" as a number instead of a string (#22)
neo451 Mar 8, 2025
06a32cc
nit: remove tracking from youtube URL
ddogfoodd Mar 9, 2025
7481090
Add text/uri-list support for `paste_img`
ottersome Feb 20, 2025
0af6f97
Merge pull request #23 from ddogfoodd/main
guspix Mar 13, 2025
15b8c5f
chore(docs): auto generate docs
guspix Mar 13, 2025
5079e0a
feat: `smart_action` shows tag picker when cursor is on a tag (#36)
sotte Mar 30, 2025
78a02d8
chore(docs): auto generate docs
neo451 Mar 30, 2025
9879280
Fix: blink.add_provider is deprecated - use add_source_provider inste…
horiagug Mar 31, 2025
5774236
Search for templates folder in vault_root first (#46)
sstark Apr 6, 2025
36df07b
ObsidianToggleCheckbox works with numbered lists (#48)
sotte Apr 9, 2025
e3c14f2
feat: healthcheck and minimal_sandbox (#50)
neo451 Apr 11, 2025
80a483c
chore(docs): auto generate docs
neo451 Apr 11, 2025
32c7ffd
feat: makefile is friendlier (#49)
sotte Apr 12, 2025
e0eb92c
chore(release): bump version to v3.10.0 for release
neo451 Apr 12, 2025
e4de1c4
Merge branch 'main' into main
neo451 Apr 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Make sure that the path there to plenary is correct for you.

## Keeping the CHANGELOG up-to-date

This project tries hard to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and we maintain a [`CHANGELOG`](https://github.com/epwalsh/obsidian.nvim/blob/main/CHANGELOG.md) with a format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This project tries hard to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and we maintain a [`CHANGELOG`](https://github.com/obsidian-nvim/obsidian.nvim/blob/main/CHANGELOG.md) with a format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
If your PR addresses a bug or makes any other substantial change, please be sure to add an entry under the "Unreleased" section at the top of `CHANGELOG.md`.
Entries should always be in the form of a list item under a level-3 header of either "Added", "Fixed", "Changed", or "Removed" for the most part.
If the corresponding level-3 header for your item does not already exist in the "Unreleased" section, you should add it.
Expand Down Expand Up @@ -49,7 +49,7 @@ However you can test how changes to the README will affect the Vim doc by runnin
To do this you'll need install `pandoc` (e.g. `brew install pandoc` on Mac) and clone [panvimdoc](https://github.com/kdheepak/panvimdoc). Then from the panvimdoc repo root, run:

```bash
./panvimdoc.sh --project-name obsidian --input-file ../../epwalsh/obsidian.nvim/README.md --description 'a plugin for writing and navigating an Obsidian vault' --toc 'false' --vim-version 'NVIM v0.8.0' --demojify 'false' --dedup-subheadings 'false' --shift-heading-level-by '-1' && mv doc/obsidian.txt /tmp/
./panvimdoc.sh --project-name obsidian --input-file ../../obsidian-nvim/obsidian.nvim/README.md --description 'a plugin for writing and navigating an Obsidian vault' --toc 'false' --vim-version 'NVIM v0.8.0' --demojify 'false' --dedup-subheadings 'false' --shift-heading-level-by '-1' && mv doc/obsidian.txt /tmp/
```

This will build the Vim documentation to `/tmp/obsidian.txt`.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ body:
- type: markdown
attributes:
value: >
#### Before submitting a bug, please make sure the issue hasn't been already addressed by searching through [the existing and past issues](https://github.com/epwalsh/obsidian.nvim/issues?q=is%3Aissue+sort%3Acreated-desc+).
#### Before submitting a bug, please make sure the issue hasn't been already addressed by searching through [the existing and past issues](https://github.com/obsidian-nvim/obsidian.nvim/issues?q=is%3Aissue+sort%3Acreated-desc+).
- type: textarea
attributes:
label: 🐛 Describe the bug
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docs
on:
pull_request:
branches:
- '*'
- "*"
push:
branches: [main]
workflow_dispatch:
Expand All @@ -14,9 +14,7 @@ concurrency:

env:
runtime: ~/.local/share/nvim/site/pack/vendor/start
minidoc-git: https://github.com/echasnovski/mini.doc
minidoc-path: ~/.local/share/nvim/site/pack/vendor/start/mini.doc
nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz

jobs:
docs:
Expand All @@ -38,7 +36,6 @@ jobs:
mkdir -p ${{ env.runtime }}
mkdir -p _neovim
curl -sL ${{ env.nvim_url }} | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
git clone --depth 1 ${{ env.minidoc-git }} ${{ env.minidoc-path }}
ln -s $(pwd) ${{ env.runtime }}

- name: Generate API docs
Expand Down Expand Up @@ -74,5 +71,5 @@ jobs:
if: github.event_name != 'pull_request'
with:
commit_user_name: github-actions[bot]
commit_message: 'chore(docs): auto generate docs'
commit_message: "chore(docs): auto generate docs"
branch: ${{ github.head_ref }}
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

include:
- os: ubuntu-latest
nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz
packages: luarocks ripgrep
manager: sudo apt-get

Expand Down
141 changes: 80 additions & 61 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,40 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) with respect to the public API, which currently includes the installation steps, dependencies, configuration, keymappings, commands, and other plugin functionality. At the moment this does *not* include the Lua `Client` API, although in the future it will once that API stabilizes.
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) with respect to the public API, which currently includes the installation steps, dependencies, configuration, keymappings, commands, and other plugin functionality. At the moment this does _not_ include the Lua `Client` API, although in the future it will once that API stabilizes.

## Unreleased

### Added

- Added support `text/uri-list` to `ObsidianPasteImg`.

## [v3.10.0](https://github.com/obsidian-nvim/obsidian.nvim/releases/tag/v3.10.0) - 2025-04-12

### Added

- Added `opts.follow_img_func` option for customizing how to handle image paths.
- Added better handling for undefined template fields, which will now be prompted for.
- Added support for the [`snacks.picker`](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) picker
- Added support for the [`blink.cmp`](https://github.com/Saghen/blink.cmp) completion plugin.
- Added health check module
- Added a minimal sandbox script `minimal.lua`

### Changed

- Renamed `opts.image_name_func` to `opts.attachments.img_name_func`.
- Default to not activate ui render when `render-markdown.nvim` or `markview.nvim` is present
- `smart_action` shows picker for tags (`ObsidianTag`) when cursor is on a tag
- `ObsidianToggleCheckbox` now works with numbered lists
- `Makefile` is friendlier: self-documenting and automatically gets dependencies

### Fixed

- Fixed an edge case with collecting backlinks.
- Fixed typo in `ObsidianPasteImg`'s command description
- Fixed the case when `opts.attachments` is `nil`.
- Fixed bug where `ObsidianNewFromTemplate` did not respect `note_id_func`
- Fixed bug where parser treats "Nan" as a number instead of a string

## [v3.9.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v3.9.0) - 2024-07-11

Expand Down Expand Up @@ -189,60 +205,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [v3.7.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v3.7.0) - 2024-03-08

There's a lot of new features and improvements here that I'm really excited about 🥳 They've improved my workflow a ton and I hope they do for you too. To highlight the 3 biggest additions:

1. 🔗 Full support for header anchor links and block links! That means both for following links and completion of links. Various forms of anchor/block links are support. Here are a few examples:
- Typical Obsidian-style wiki links, e.g. `[[My note#Heading 1]]`, `[[My note#Heading 1#Sub heading]]`, `[[My note#^block-123]]`.
- Wiki links with a label, e.g. `[[my-note#heading-1|Heading 1 in My Note]]`.
- Markdown links, e.g. `[Heading 1 in My Note](my-note.md#heading-1)`.

We also support links to headers within the same note, like for a table of contents, e.g. `[[#Heading 1]]`, `[[#heading-1|Heading]]`, `[[#^block-1]]`.
- Typical Obsidian-style wiki links, e.g. `[[My note#Heading 1]]`, `[[My note#Heading 1#Sub heading]]`, `[[My note#^block-123]]`.
- Wiki links with a label, e.g. `[[my-note#heading-1|Heading 1 in My Note]]`.
- Markdown links, e.g. `[Heading 1 in My Note](my-note.md#heading-1)`.

We also support links to headers within the same note, like for a table of contents, e.g. `[[#Heading 1]]`, `[[#heading-1|Heading]]`, `[[#^block-1]]`.

2. 📲 A basic callback system to let you easily customize obisidian.nvim's behavior even more. There are currently 4 events: `post_setup`, `enter_note`, `pre_write_note`, and `post_set_workspace`. You can define a function for each of these in your config.
3. 🔭 Improved picker integrations (especially for telescope), particular for the `:ObsidianTags` command. See https://github.com/epwalsh/obsidian.nvim/discussions/450 for a demo.
3. 🔭 Improved picker integrations (especially for telescope), particular for the `:ObsidianTags` command. See <https://github.com/epwalsh/obsidian.nvim/discussions/450> for a demo.

Full changelog below 👇

### Added

- Added a configurable callback system to further customize obsidian.nvim's behavior. Callbacks are defined through the `callbacks` field in the config:

```lua
callbacks = {
-- Runs at the end of `require("obsidian").setup()`.
---@param client obsidian.Client
post_setup = function(client) end,

-- Runs anytime you enter the buffer for a note.
---@param client obsidian.Client
---@param note obsidian.Note
enter_note = function(client, note) end,

-- Runs anytime you leave the buffer for a note.
---@param client obsidian.Client
---@param note obsidian.Note
leave_note = function(client, note) end,

-- Runs right before writing the buffer for a note.
---@param client obsidian.Client
---@param note obsidian.Note
pre_write_note = function(client, note) end,

-- Runs anytime the workspace is set/changed.
---@param client obsidian.Client
---@param workspace obsidian.Workspace
post_set_workspace = function(client, workspace) end,
}
```
```lua
callbacks = {
-- Runs at the end of `require("obsidian").setup()`.
---@param client obsidian.Client
post_setup = function(client) end,

-- Runs anytime you enter the buffer for a note.
---@param client obsidian.Client
---@param note obsidian.Note
enter_note = function(client, note) end,

-- Runs anytime you leave the buffer for a note.
---@param client obsidian.Client
---@param note obsidian.Note
leave_note = function(client, note) end,

-- Runs right before writing the buffer for a note.
---@param client obsidian.Client
---@param note obsidian.Note
pre_write_note = function(client, note) end,

-- Runs anytime the workspace is set/changed.
---@param client obsidian.Client
---@param workspace obsidian.Workspace
post_set_workspace = function(client, workspace) end,
}
```

- Added configuration option `note_path_func(spec): obsidian.Path` for customizing how file names for new notes are generated. This takes a single argument, a table that looks like `{ id: string, dir: obsidian.Path, title: string|? }`, and returns an `obsidian.Path` object. The default behavior is equivalent to this:

```lua
---@param spec { id: string, dir: obsidian.Path, title: string|? }
---@return string|obsidian.Path The full path to the new note.
note_path_func = function(spec)
local path = spec.dir / tostring(spec.id)
return path:with_suffix(".md")
end
```
```lua
---@param spec { id: string, dir: obsidian.Path, title: string|? }
---@return string|obsidian.Path The full path to the new note.
note_path_func = function(spec)
local path = spec.dir / tostring(spec.id)
return path:with_suffix ".md"
end
```

- Added config option `picker.tag_mappings`, analogous to `picker.note_mappings`.
- Added `log` field to `obsidian.Client` for easier access to the logger.
Expand Down Expand Up @@ -437,7 +455,7 @@ Minor internal improvements.

### Fixed

- Fixed parsing header with trailing whitespace (https://github.com/epwalsh/obsidian.nvim/issues/341#issuecomment-1925445271).
- Fixed parsing header with trailing whitespace (<https://github.com/epwalsh/obsidian.nvim/issues/341#issuecomment-1925445271>).

## [v2.9.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v2.9.0) - 2024-01-31

Expand Down Expand Up @@ -467,7 +485,7 @@ Minor internal improvements.
### Fixed

- Fixed a YAML parsing issue with unquoted URLs in an array item.
- Fixed an issue on Windows when cloning a template into a new note. The root cause was this bug in plenary: https://github.com/nvim-lua/plenary.nvim/issues/489. We've added a work-around.
- Fixed an issue on Windows when cloning a template into a new note. The root cause was this bug in plenary: <https://github.com/nvim-lua/plenary.nvim/issues/489>. We've added a work-around.

## [v2.7.1](https://github.com/epwalsh/obsidian.nvim/releases/tag/v2.7.1) - 2024-01-23

Expand All @@ -492,7 +510,7 @@ Minor internal improvements.

### Added

- Added extmarks that conceal "-", "*", or "+" with "•" by default. This can turned off by setting `.ui.bullets` to `nil` in your config.
- Added extmarks that conceal "-", "\*", or "+" with "•" by default. This can turned off by setting `.ui.bullets` to `nil` in your config.

### Fixed

Expand Down Expand Up @@ -548,26 +566,26 @@ Minor internal improvements.
- Added Lua API methods `Client:set_workspace(workspace: obsidian.Workspace)` and `Client:switch_workspace(workspace: string|obsidian.Workspace)`.
- Added the ability to override settings per workspace by providing the `overrides` field in a workspace definition. For example:

```lua
require("obsidian").setup({
workspaces = {
{
name = "personal",
path = "~/vaults/personal",
},
{
name = "work",
path = "~/vaults/work",
-- Optional, override certain settings.
overrides = {
notes_subdir = "notes",
},
```lua
require("obsidian").setup {
workspaces = {
{
name = "personal",
path = "~/vaults/personal",
},
{
name = "work",
path = "~/vaults/work",
-- Optional, override certain settings.
overrides = {
notes_subdir = "notes",
},
},
},

-- ... other options ...
})
```
-- ... other options ...
}
```

### Fixed

Expand Down Expand Up @@ -797,6 +815,7 @@ Major internal refactoring to bring performance improvements through async execu
- Added `mappings` configuration field.
- Added `open_notes_in` configuration field
- Added `backlinks` options to the config. The default is

```lua
backlinks = {
-- The default height of the backlinks pane.
Expand Down
48 changes: 36 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,60 @@
SHELL:=/usr/bin/env bash

.DEFAULT_GOAL:=help
PROJECT_NAME = "obsidian.nvim"
TEST = test/obsidian
# This is where you have plenary installed locally. Override this at runtime if yours is elsewhere.
# Depending on your setup you have to override the locations at runtime.
PLENARY = ~/.local/share/nvim/lazy/plenary.nvim/
MINIDOC = ~/.local/share/nvim/lazy/mini.doc/

.PHONY : all
all : style lint test

.PHONY : test
test :
################################################################################
##@ Developmment
.PHONY: chores
chores: style lint test ## Run all develoment tasks

.PHONY: test
test: $(PLENARY) ## Run unit tests
PLENARY=$(PLENARY) nvim \
--headless \
--noplugin \
-u test/minimal_init.vim \
-c "PlenaryBustedDirectory $(TEST) { minimal_init = './test/minimal_init.vim' }"

$(PLENARY):
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim.git $(PLENARY)

.PHONY: api-docs
api-docs :
api-docs: $(MINIDOC) ## Generate API documentation with mini.doc
MINIDOC=$(MINIDOC) nvim \
--headless \
--noplugin \
-u scripts/minimal_init.vim \
-c "luafile scripts/generate_api_docs.lua" \
-c "qa!"

.PHONY : lint
lint :
$(MINIDOC):
git clone --depth 1 https://github.com/echasnovski/mini.doc $(MINIDOC)

.PHONY: lint
lint: ## Lint the code
luacheck .

.PHONY : style
style :
.PHONY: style
style: ## format the code
stylua --check .

.PHONY : version
version :

################################################################################
##@ Helpers
.PHONY: version
version: ## Print the obsidian.nvim version
@nvim --headless -c 'lua print("v" .. require("obsidian").VERSION)' -c q 2>&1

.PHONY: help
help: ## Display this help
@echo "Welcome to $$(tput bold)${PROJECT_NAME}$$(tput sgr0) 🥳📈🎉"
@echo ""
@echo "To get started:"
@echo " >>> $$(tput bold)make chores$$(tput sgr0)"
@awk 'BEGIN {FS = ":.*##"; printf "\033[36m\033[0m"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
Loading