Skip to content

Commit a8a3577

Browse files
Add note to README and healthcheck for obsidian.nvim
## Details A few issues have come up with conflicting UI behavior between this plugin and obsidian.nvim. Add a note about this to the README similar to vimwiki. Include conflicting plugins in healthcheck. Add acknowledge_conflicts configuration field to avoid warning message since we can't easily read the obsidian configuration.
1 parent 2c8be07 commit a8a3577

File tree

7 files changed

+68
-2
lines changed

7 files changed

+68
-2
lines changed

Diff for: README.md

+17
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ require('render-markdown').setup({
166166
-- Vim modes that will show a rendered view of the markdown file
167167
-- All other modes will be uneffected by this plugin
168168
render_modes = { 'n', 'c' },
169+
-- Set to avoid seeing warnings for conflicts in health check
170+
acknowledge_conflicts = false,
169171
exclude = {
170172
-- Buftypes ignored by this plugin, see :h 'buftype'
171173
buftypes = {},
@@ -740,6 +742,21 @@ The table below shows all the highlight groups with their default link
740742
> vim.treesitter.language.register('markdown', 'vimwiki')
741743
> ```
742744
745+
## obsidian.nvim
746+
747+
> [!NOTE]
748+
>
749+
> [obsidian.nvim](https://github.com/epwalsh/obsidian.nvim) provides UI functionality
750+
> that is enabled by default. While there may be a way to have the 2 work together,
751+
> for the foreseeable future only one of these plugins should be used for the UI.
752+
> If you choose this plugin disable the `obsidian.nvim` UI with:
753+
>
754+
> ```lua
755+
> require('obsidian').setup({
756+
> ui = { enable = false },
757+
> })
758+
> ```
759+
743760
## Images
744761
745762
> [!NOTE]

Diff for: doc/markdown-ecosystem.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ different functionality will clash.
1313

1414
- [headlines.nvim](https://github.com/lukas-reineke/headlines.nvim) - Same high
1515
level idea and starting point of this plugin, but with different feature sets
16+
- [obsidian.nvim](https://github.com/epwalsh/obsidian.nvim) - While this plugin
17+
has many more `obsidian` related features it also provides a UI enabled by
18+
default that clashes with this plugin
1619

1720
## Render in Browser
1821

Diff for: doc/render-markdown.txt

+17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Table of Contents *render-markdown-table-of-contents*
2424
7. Colors |render-markdown-colors|
2525
8. Info |render-markdown-info|
2626
- vimwiki |render-markdown-info-vimwiki|
27+
- obsidian.nvim |render-markdown-info-obsidian.nvim|
2728
- Images |render-markdown-info-images|
2829
- Additional |render-markdown-info-additional|
2930

@@ -206,6 +207,8 @@ Full Default Configuration ~
206207
-- Vim modes that will show a rendered view of the markdown file
207208
-- All other modes will be uneffected by this plugin
208209
render_modes = { 'n', 'c' },
210+
-- Set to avoid seeing warnings for conflicts in health check
211+
acknowledge_conflicts = false,
209212
exclude = {
210213
-- Buftypes ignored by this plugin, see :h 'buftype'
211214
buftypes = {},
@@ -829,6 +832,20 @@ VIMWIKI *render-markdown-info-vimwiki*
829832
vim.treesitter.language.register('markdown', 'vimwiki')
830833
<
831834

835+
OBSIDIAN.NVIM *render-markdown-info-obsidian.nvim*
836+
837+
838+
[!NOTE]
839+
obsidian.nvim <https://github.com/epwalsh/obsidian.nvim> provides UI
840+
functionality that is enabled by default. While there may be a way to have the
841+
2 work together, for the foreseeable future only one of these plugins should be
842+
used for the UI. If you choose this plugin disable the `obsidian.nvim` UI with:
843+
>lua
844+
require('obsidian').setup({
845+
ui = { enable = false },
846+
})
847+
<
848+
832849
IMAGES *render-markdown-info-images*
833850

834851

Diff for: lua/render-markdown/health.lua

+26-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function M.check()
2020
local latex_advice = 'Disable LaTeX support to avoid this warning by setting { latex = { enabled = false } }'
2121

2222
vim.health.start('markdown.nvim [nvim-treesitter]')
23-
local ok = pcall(require, 'nvim-treesitter')
24-
if ok then
23+
local has_treesitter = pcall(require, 'nvim-treesitter')
24+
if has_treesitter then
2525
vim.health.ok('installed')
2626

2727
M.check_parser('markdown')
@@ -46,6 +46,17 @@ function M.check()
4646
else
4747
vim.health.ok('none to check')
4848
end
49+
50+
vim.health.start('markdown.nvim [conflicts]')
51+
if state.config.acknowledge_conflicts then
52+
vim.health.ok('conflicts acknowledged')
53+
else
54+
M.check_plugin('headlines')
55+
M.check_plugin('obsidian', {
56+
'Ensure UI is disabled by setting ui = { enable = false } in obsidian.nvim config',
57+
'Acknowledge conflicts to avoid this warning by setting { acknowledge_conflicts = true }',
58+
})
59+
end
4960
end
5061

5162
---@param minimum string
@@ -85,4 +96,17 @@ function M.check_executable(name, advice)
8596
end
8697
end
8798

99+
---@param name string
100+
---@param advice string[]?
101+
function M.check_plugin(name, advice)
102+
local has_plugin = pcall(require, name)
103+
if not has_plugin then
104+
vim.health.ok(name .. ': not installed')
105+
elseif advice == nil then
106+
vim.health.error(name .. ': installed')
107+
else
108+
vim.health.warn(name .. ': installed', advice)
109+
end
110+
end
111+
88112
return M

Diff for: lua/render-markdown/init.lua

+3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ local M = {}
113113
---@field public log_level? 'debug'|'error'
114114
---@field public file_types? string[]
115115
---@field public render_modes? string[]
116+
---@field public acknowledge_conflicts? boolean
116117
---@field public exclude? render.md.UserExclude
117118
---@field public anti_conceal? render.md.UserAntiConceal
118119
---@field public latex? render.md.UserLatex
@@ -189,6 +190,8 @@ M.default_config = {
189190
-- Vim modes that will show a rendered view of the markdown file
190191
-- All other modes will be uneffected by this plugin
191192
render_modes = { 'n', 'c' },
193+
-- Set to avoid seeing warnings for conflicts in health check
194+
acknowledge_conflicts = false,
192195
exclude = {
193196
-- Buftypes ignored by this plugin, see :h 'buftype'
194197
buftypes = {},

Diff for: lua/render-markdown/state.lua

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ function state.validate()
8484
log_level = one_of(config.log_level, { 'debug', 'error' }),
8585
file_types = string_array(config.file_types),
8686
render_modes = string_array(config.render_modes),
87+
acknowledge_conflicts = { config.acknowledge_conflicts, 'boolean' },
8788
exclude = { config.exclude, 'table' },
8889
anti_conceal = { config.anti_conceal, 'table' },
8990
latex = { config.latex, 'table' },

Diff for: lua/render-markdown/types.lua

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
---@field public log_level 'debug'|'error'
9999
---@field public file_types string[]
100100
---@field public render_modes string[]
101+
---@field public acknowledge_conflicts boolean
101102
---@field public exclude render.md.Exclude
102103
---@field public anti_conceal render.md.AntiConceal
103104
---@field public latex render.md.Latex

0 commit comments

Comments
 (0)