Skip to content

Commit da01374

Browse files
authored
Merge pull request #14 from neo451/main
doc: add instruction for rocks.nvim, warning for packer.nvim
2 parents bacd8b2 + 39ff5a0 commit da01374

File tree

3 files changed

+50
-23
lines changed

3 files changed

+50
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
### Changed
1818

1919
- Renamed `opts.image_name_func` to `opts.attachments.img_name_func`.
20+
- Default to not activate ui render when `render-markdown.nvim` or `markview.nvim` is present
2021

2122
### Fixed
2223

README.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ Here are some examples using different plugin managers. The full set of [plugin
120120
121121
#### Using [`lazy.nvim`](https://github.com/folke/lazy.nvim)
122122

123+
<details><summary>Click for install snippet</summary>
124+
123125
```lua
124126
return {
125127
"obsidian-nvim/obsidian.nvim",
126-
version = "*", -- recommended, use latest release instead of latest commit
128+
version = "*", -- recommended, use latest release instead of latest commit
127129
lazy = true,
128130
ft = "markdown",
129131
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
@@ -157,20 +159,36 @@ return {
157159
}
158160
```
159161

162+
</details>
163+
164+
#### Using [`rocks.nvim`](https://github.com/nvim-neorocks/rocks.nvim)
165+
166+
<details><summary>Click for install snippet</summary>
167+
168+
```vim
169+
:Rocks install obsidian
170+
```
171+
172+
</details>
173+
160174
#### Using [`packer.nvim`](https://github.com/wbthomason/packer.nvim)
161175

176+
It is not recommended because packer.nvim is currently unmaintained
177+
178+
<details><summary>Click for install snippet</summary>
179+
162180
```lua
163-
use({
181+
use {
164182
"obsidian-nvim/obsidian.nvim",
165-
tag = "*", -- recommended, use latest release instead of latest commit
183+
tag = "*", -- recommended, use latest release instead of latest commit
166184
requires = {
167185
-- Required.
168186
"nvim-lua/plenary.nvim",
169187

170188
-- see below for full list of optional dependencies 👇
171189
},
172190
config = function()
173-
require("obsidian").setup({
191+
require("obsidian").setup {
174192
workspaces = {
175193
{
176194
name = "personal",
@@ -183,31 +201,39 @@ use({
183201
},
184202

185203
-- see below for full list of options 👇
186-
})
204+
}
187205
end,
188-
})
206+
}
189207
```
190208

209+
</details>
210+
191211
### Plugin dependencies
192212

193213
The only **required** plugin dependency is [plenary.nvim](https://github.com/nvim-lua/plenary.nvim), but there are a number of optional dependencies that enhance the obsidian.nvim experience.
194214

195215
**Completion:**
196216

197-
- **[recommended]** [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp): for completion of note references.
198-
- [blink.cmp](https://github.com/Saghen/blink.cmp) (new): for completion of note references.
217+
- **[recommended]** [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
218+
- [blink.cmp](https://github.com/Saghen/blink.cmp) (new)
199219

200220
**Pickers:**
201221

202-
- **[recommended]** [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim): for search and quick-switch functionality.
203-
- [Mini.Pick](https://github.com/echasnovski/mini.pick) from the mini.nvim library: an alternative to telescope for search and quick-switch functionality.
204-
- [ibhagwan/fzf-lua](https://github.com/ibhagwan/fzf-lua): another alternative to telescope for search and quick-switch functionality.
205-
- [Snacks.Picker](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) from the snacks.nvim library: an alternative to mini and telescope for search and quick-switch functionality.
222+
- **[recommended]** [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
223+
- [ibhagwan/fzf-lua](https://github.com/ibhagwan/fzf-lua)
224+
- [Mini.Pick](https://github.com/echasnovski/mini.pick) from the mini.nvim library
225+
- [Snacks.Picker](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) from the snacks.nvim library
206226

207227
**Syntax highlighting:**
208228

209-
- **[recommended]** [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter): for base markdown syntax highlighting. See [syntax highlighting](#syntax-highlighting) for more details.
210-
- [preservim/vim-markdown](https://github.com/preservim/vim-markdown): an alternative to nvim-treesitter for syntax highlighting (see [syntax highlighting](#syntax-highlighting) for more details), plus other cool features.
229+
See [syntax highlighting](#syntax-highlighting) for more details.
230+
231+
- For base syntax highlighting:
232+
- **[recommended]** [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
233+
- [preservim/vim-markdown](https://github.com/preservim/vim-markdown)
234+
- For additional syntax features:
235+
- [render-markdown.nvim](https://github.com/MeanderingProgrammer/render-markdown.nvim)
236+
- [markview.nvim](https://github.com/OXY2DEV/markview.nvim)
211237

212238
**Miscellaneous:**
213239

@@ -217,7 +243,7 @@ If you choose to use any of these you should include them in the "dependencies"
217243

218244
### Configuration options
219245

220-
This is a complete list of all of the options that can be passed to `require("obsidian").setup()`. The settings below are *not necessarily the defaults, but represent reasonable default settings*. Please read each option carefully and customize it to your needs:
246+
This is a complete list of all of the options that can be passed to `require("obsidian").setup()`. The settings below are _not necessarily the defaults, but represent reasonable default settings_. Please read each option carefully and customize it to your needs:
221247

222248
```lua
223249
{
@@ -564,7 +590,7 @@ config = {
564590
name = "personal",
565591
path = "~/vaults/personal",
566592
},
567-
}
593+
},
568594
}
569595
```
570596

@@ -591,13 +617,12 @@ config = {
591617
-- ...
592618
},
593619
},
594-
}
620+
},
595621
}
596622
```
597623

598624
obsidian.nvim also supports "dynamic" workspaces. These are simply workspaces where the `path` is set to a Lua function (that returns a path) instead of a hard-coded path. This can be useful in several scenarios, such as when you want a workspace whose `path` is always set to the parent directory of the current buffer:
599625

600-
601626
```lua
602627
config = {
603628
workspaces = {
@@ -607,7 +632,7 @@ config = {
607632
return assert(vim.fs.dirname(vim.api.nvim_buf_get_name(0)))
608633
end,
609634
},
610-
}
635+
},
611636
}
612637
```
613638

@@ -627,12 +652,12 @@ Note that in order to trigger completion for tags _within YAML frontmatter_ you
627652
If you're using [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/README.md) you're configuration should include both "markdown" and "markdown_inline" sources:
628653

629654
```lua
630-
require("nvim-treesitter.configs").setup({
655+
require("nvim-treesitter.configs").setup {
631656
ensure_installed = { "markdown", "markdown_inline", ... },
632657
highlight = {
633658
enable = true,
634659
},
635-
})
660+
}
636661
```
637662

638663
If you use `vim-markdown` you'll probably want to disable its frontmatter syntax highlighting (`vim.g.vim_markdown_frontmatter = 1`) which I've found doesn't work very well.
@@ -734,7 +759,7 @@ templates = {
734759

735760
### Usage outside of a workspace or vault
736761

737-
It's possible to configure obsidian.nvim to work on individual markdown files outside of a regular workspace / Obsidian vault by configuring a "dynamic" workspace. To do so you just need to add a special workspace with a function for the `path` field (instead of a string), which should return a *parent* directory of the current buffer. This tells obsidian.nvim to use that directory as the workspace `path` and `root` (vault root) when the buffer is not located inside another fixed workspace.
762+
It's possible to configure obsidian.nvim to work on individual markdown files outside of a regular workspace / Obsidian vault by configuring a "dynamic" workspace. To do so you just need to add a special workspace with a function for the `path` field (instead of a string), which should return a _parent_ directory of the current buffer. This tells obsidian.nvim to use that directory as the workspace `path` and `root` (vault root) when the buffer is not located inside another fixed workspace.
738763

739764
For example, to extend the configuration above this way:
740765

lua/obsidian/client.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ Client.set_workspace = function(self, workspace, opts)
125125
self.callback_manager = CallbackManager.new(self, self.opts.callbacks)
126126

127127
-- Setup UI add-ons.
128-
if self.opts.ui.enable then
128+
local has_no_renderer = not (util.get_plugin_info "render-markdown.nvim" or util.get_plugin_info "markview.nvim")
129+
if has_no_renderer and self.opts.ui.enable then
129130
require("obsidian.ui").setup(self.current_workspace, self.opts.ui)
130131
end
131132

0 commit comments

Comments
 (0)