Skip to content

Commit 2ec3d7b

Browse files
authored
Merge branch 'obsidian-nvim:main' into main
2 parents 1a6fbff + 3baea08 commit 2ec3d7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+720
-204
lines changed

.github/CONTRIBUTING.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Docs
33
on:
44
pull_request:
55
branches:
6-
- '*'
6+
- "*"
77
push:
88
branches: [main]
99
workflow_dispatch:
@@ -14,8 +14,6 @@ concurrency:
1414

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

2119
jobs:
@@ -38,7 +36,6 @@ jobs:
3836
mkdir -p ${{ env.runtime }}
3937
mkdir -p _neovim
4038
curl -sL ${{ env.nvim_url }} | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
41-
git clone --depth 1 ${{ env.minidoc-git }} ${{ env.minidoc-path }}
4239
ln -s $(pwd) ${{ env.runtime }}
4340
4441
- name: Generate API docs
@@ -74,5 +71,5 @@ jobs:
7471
if: github.event_name != 'pull_request'
7572
with:
7673
commit_user_name: github-actions[bot]
77-
commit_message: 'chore(docs): auto generate docs'
74+
commit_message: "chore(docs): auto generate docs"
7875
branch: ${{ github.head_ref }}

CHANGELOG.md

Lines changed: 82 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,43 @@
33
All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6-
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.
6+
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.
77

88
## Unreleased
99

1010
### Added
1111

12+
- Added default `image_name_func` similar to Obsidian's.
13+
- Added support `text/uri-list` to `ObsidianPasteImg`.
14+
15+
### Changed
16+
17+
- `ObsidianToggleCheckbox` now works in visual mode for multiline toggle
18+
- `ObsidianRename` input field is pre-filled filled with the current note id to ease renaming
19+
- Improved type annotations for user commands: add `CommandArgs` type.
20+
21+
### Fixed
22+
23+
- Enhanced completion menu to correctly display and handle non-English (ex. Korean) file names and tags in link, fixing Unicode encoding issues
24+
25+
## [v3.10.0](https://github.com/obsidian-nvim/obsidian.nvim/releases/tag/v3.10.0) - 2025-04-12
26+
27+
### Added
28+
1229
- Added `opts.follow_img_func` option for customizing how to handle image paths.
1330
- Added better handling for undefined template fields, which will now be prompted for.
1431
- Added support for the [`snacks.picker`](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) picker
1532
- Added support for the [`blink.cmp`](https://github.com/Saghen/blink.cmp) completion plugin.
33+
- Added health check module
34+
- Added a minimal sandbox script `minimal.lua`
1635

1736
### Changed
1837

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

2244
### Fixed
2345

@@ -196,11 +218,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
196218
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:
197219

198220
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:
199-
- Typical Obsidian-style wiki links, e.g. `[[My note#Heading 1]]`, `[[My note#Heading 1#Sub heading]]`, `[[My note#^block-123]]`.
200-
- Wiki links with a label, e.g. `[[my-note#heading-1|Heading 1 in My Note]]`.
201-
- Markdown links, e.g. `[Heading 1 in My Note](my-note.md#heading-1)`.
202221

203-
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]]`.
222+
- Typical Obsidian-style wiki links, e.g. `[[My note#Heading 1]]`, `[[My note#Heading 1#Sub heading]]`, `[[My note#^block-123]]`.
223+
- Wiki links with a label, e.g. `[[my-note#heading-1|Heading 1 in My Note]]`.
224+
- Markdown links, e.g. `[Heading 1 in My Note](my-note.md#heading-1)`.
225+
226+
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]]`.
204227

205228
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.
206229
3. 🔭 Improved picker integrations (especially for telescope), particular for the `:ObsidianTags` command. See <https://github.com/epwalsh/obsidian.nvim/discussions/450> for a demo.
@@ -211,44 +234,44 @@ Full changelog below 👇
211234

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

214-
```lua
215-
callbacks = {
216-
-- Runs at the end of `require("obsidian").setup()`.
217-
---@param client obsidian.Client
218-
post_setup = function(client) end,
219-
220-
-- Runs anytime you enter the buffer for a note.
221-
---@param client obsidian.Client
222-
---@param note obsidian.Note
223-
enter_note = function(client, note) end,
224-
225-
-- Runs anytime you leave the buffer for a note.
226-
---@param client obsidian.Client
227-
---@param note obsidian.Note
228-
leave_note = function(client, note) end,
229-
230-
-- Runs right before writing the buffer for a note.
231-
---@param client obsidian.Client
232-
---@param note obsidian.Note
233-
pre_write_note = function(client, note) end,
234-
235-
-- Runs anytime the workspace is set/changed.
236-
---@param client obsidian.Client
237-
---@param workspace obsidian.Workspace
238-
post_set_workspace = function(client, workspace) end,
239-
}
240-
```
237+
```lua
238+
callbacks = {
239+
-- Runs at the end of `require("obsidian").setup()`.
240+
---@param client obsidian.Client
241+
post_setup = function(client) end,
242+
243+
-- Runs anytime you enter the buffer for a note.
244+
---@param client obsidian.Client
245+
---@param note obsidian.Note
246+
enter_note = function(client, note) end,
247+
248+
-- Runs anytime you leave the buffer for a note.
249+
---@param client obsidian.Client
250+
---@param note obsidian.Note
251+
leave_note = function(client, note) end,
252+
253+
-- Runs right before writing the buffer for a note.
254+
---@param client obsidian.Client
255+
---@param note obsidian.Note
256+
pre_write_note = function(client, note) end,
257+
258+
-- Runs anytime the workspace is set/changed.
259+
---@param client obsidian.Client
260+
---@param workspace obsidian.Workspace
261+
post_set_workspace = function(client, workspace) end,
262+
}
263+
```
241264

242265
- 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:
243266

244-
```lua
245-
---@param spec { id: string, dir: obsidian.Path, title: string|? }
246-
---@return string|obsidian.Path The full path to the new note.
247-
note_path_func = function(spec)
248-
local path = spec.dir / tostring(spec.id)
249-
return path:with_suffix(".md")
250-
end
251-
```
267+
```lua
268+
---@param spec { id: string, dir: obsidian.Path, title: string|? }
269+
---@return string|obsidian.Path The full path to the new note.
270+
note_path_func = function(spec)
271+
local path = spec.dir / tostring(spec.id)
272+
return path:with_suffix ".md"
273+
end
274+
```
252275

253276
- Added config option `picker.tag_mappings`, analogous to `picker.note_mappings`.
254277
- Added `log` field to `obsidian.Client` for easier access to the logger.
@@ -498,7 +521,7 @@ Minor internal improvements.
498521

499522
### Added
500523

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

503526
### Fixed
504527

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

557-
```lua
558-
require("obsidian").setup({
559-
workspaces = {
560-
{
561-
name = "personal",
562-
path = "~/vaults/personal",
563-
},
564-
{
565-
name = "work",
566-
path = "~/vaults/work",
567-
-- Optional, override certain settings.
568-
overrides = {
569-
notes_subdir = "notes",
570-
},
580+
```lua
581+
require("obsidian").setup {
582+
workspaces = {
583+
{
584+
name = "personal",
585+
path = "~/vaults/personal",
586+
},
587+
{
588+
name = "work",
589+
path = "~/vaults/work",
590+
-- Optional, override certain settings.
591+
overrides = {
592+
notes_subdir = "notes",
571593
},
572594
},
595+
},
573596

574-
-- ... other options ...
575-
})
576-
```
597+
-- ... other options ...
598+
}
599+
```
577600

578601
### Fixed
579602

@@ -905,7 +928,7 @@ Major internal refactoring to bring performance improvements through async execu
905928
### Added
906929

907930
- Added support for [fzf-lua](https://github.com/ibhagwan/fzf-lua) as one of the possible fallbacks for the `:ObsidianQuickSwitch` command.
908-
- Added `:ObsidianQuickSwitch` to fuzzy-find a note by name in telescope/fzf *a la* <C-O> in Obsidian.
931+
- Added `:ObsidianQuickSwitch` to fuzzy-find a note by name in telescope/fzf _a la_ <C-O> in Obsidian.
909932
- Added support for [fzf-lua](https://github.com/ibhagwan/fzf-lua) as one of the possible fallbacks for the `:ObsidianSearch` command.
910933
- Added `:ObsidianFollowLink` and companion function `util.cursor_on_markdown_link`
911934
- Added `:ObsidianLink` and `:ObsidianLinkNew` commands.

CONTRIBUTING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Contributing to `obsidian.nvim`
2+
3+
Thanks for considering contributing!
4+
Please read this document to learn the various steps you should take before submitting a pull request.
5+
6+
## TL;DR
7+
8+
- Start an issue to discuss the planned changes
9+
- To submit a pull request
10+
- Start developing your feature in a branch
11+
- Make sure that your codes complies the `obsidian.nvim` code style, run
12+
`make chores`
13+
- The PR should contain
14+
- The code changes
15+
- Tests for the code changes
16+
- Documentation for the code changes (in the code itself and in the `README.md`)
17+
- `CHANGELOG.md` entry for the code changes
18+
19+
## Details
20+
21+
Note: we automate tedious tasks using a `Makefile` in the root of the repository.
22+
Just call `make` to see what you can do, or `make chores` to run the most important tasks on your code.
23+
You can override some parts of the `Makefile` by setting env variables.
24+
25+
### Local development with LuaLS and `plenary.nvim`
26+
27+
If you're using the [Lua Language Server](https://luals.github.io) (LuaLS) you'll probably want to add `plenary.nvim` as a workspace library since we rely heavily on plenary throughout the codebase.
28+
You can do this by adding a `.luarc.json` configuration file that looks like this:
29+
30+
```json
31+
{
32+
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
33+
"workspace.library": ["~/.local/share/nvim/lazy/plenary.nvim/"],
34+
"runtime.version": "Lua 5.1"
35+
}
36+
```
37+
38+
Make sure that the path there to plenary is correct for you.
39+
40+
### Keeping the `CHANGELOG.md` up-to-date
41+
42+
This project tries hard to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
43+
and we maintain a [`CHANGELOG`](https://github.com/obsidian-nvim/obsidian.nvim/blob/main/CHANGELOG.md)
44+
with a format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
45+
If your PR addresses a bug or makes any other substantial change,
46+
please be sure to add an entry under the "Unreleased" section at the top of `CHANGELOG.md`.
47+
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.
48+
If the corresponding level-3 header for your item does not already exist in the "Unreleased" section, you should add it.
49+
50+
### Formatting code
51+
52+
TL;DR: `make style`
53+
54+
Lua code should be formatted using [StyLua](https://github.com/JohnnyMorganz/StyLua).
55+
Once you have StyLua installed, you can run `make style` to automatically apply styling to all of the Lua files in this repo.
56+
57+
### Linting code
58+
59+
TL;DR: `make lint`
60+
61+
We use [luacheck](https://github.com/mpeterv/luacheck) to lint the Lua code.
62+
Once you have `luacheck` installed, you can run `make lint` to get a report.
63+
64+
### Running tests
65+
66+
TL;DR: `make test`
67+
68+
Tests are written in the `test/` folder and are run using the [Plenary](https://github.com/nvim-lua/plenary.nvim) test harness.
69+
Since Plenary is a dependency of `obsidian.nvim`, you probably already have it installed somewhere.
70+
To run the tests locally you'll need to know where it's installed, which depends on your plugin manager.
71+
In my case I use `Lazy.nvim` which puts Plenary at `~/.local/share/nvim/lazy/plenary.nvim/`.
72+
73+
### Building the vim user documentation
74+
75+
TL;DR: `make user-docs`
76+
77+
The Vim documentation lives at `doc/obsidian.txt`, which is automatically generated from the `README.md` using [panvimdoc](https://github.com/kdheepak/panvimdoc).
78+
**Please only commit documentation changes to the `README.md`, not `doc/obsidian.txt`.**
79+
80+
However you can test how changes to the README will affect the Vim doc by running `panvimdoc` locally.
81+
To do this you'll need install `pandoc` (e.g. `brew install pandoc` on Mac)
82+
and clone [panvimdoc](https://github.com/kdheepak/panvimdoc) (e.g. `git clone [email protected]:kdheepak/panvimdoc.git ../panvimdoc`).
83+
84+
This will build the Vim documentation to `/tmp/obsidian.txt`.
85+
86+
### Building the vim API documentation
87+
88+
TL;DR: `make api-docs`
89+
90+
The API docs lives in `doc/obsidian_api.txt` and is generated from the source code using [`mini.docs`](https://github.com/echasnovski/mini.doc).
91+
It is automatically generated via CI.

0 commit comments

Comments
 (0)