[nvim] Improves markdown checkbox experience
This commit is contained in:
44
home-manager/features/neovim/config/lua/plugins/markdown.lua
Normal file
44
home-manager/features/neovim/config/lua/plugins/markdown.lua
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
return {
|
||||||
|
"MeanderingProgrammer/render-markdown.nvim",
|
||||||
|
opts = {
|
||||||
|
checkbox = {
|
||||||
|
enabled = true,
|
||||||
|
render_modes = true,
|
||||||
|
unchecked = {
|
||||||
|
icon = " ",
|
||||||
|
highlight = "RenderMarkdownUnchecked",
|
||||||
|
scope_highlight = nil,
|
||||||
|
},
|
||||||
|
checked = {
|
||||||
|
-- Replaces '[x]' of 'task_list_marker_checked'.
|
||||||
|
icon = " ",
|
||||||
|
-- Highlight for the checked icon.
|
||||||
|
highlight = "RenderMarkdownChecked",
|
||||||
|
-- Highlight for item associated with checked checkbox.
|
||||||
|
scope_highlight = nil,
|
||||||
|
},
|
||||||
|
-- Define custom checkbox states, more involved, not part of the markdown grammar.
|
||||||
|
-- As a result this requires neovim >= 0.10.0 since it relies on 'inline' extmarks.
|
||||||
|
-- The key is for healthcheck and to allow users to change its values, value type below.
|
||||||
|
-- | raw | matched against the raw text of a 'shortcut_link' |
|
||||||
|
-- | rendered | replaces the 'raw' value when rendering |
|
||||||
|
-- | highlight | highlight for the 'rendered' icon |
|
||||||
|
-- | scope_highlight | optional highlight for item associated with custom checkbox |
|
||||||
|
-- stylua: ignore
|
||||||
|
custom = {
|
||||||
|
partial = {
|
||||||
|
raw = '[/]',
|
||||||
|
rendered = '⛋ ',
|
||||||
|
highlight = 'RenderMarkdownTodo',
|
||||||
|
scope_highlight = nil
|
||||||
|
},
|
||||||
|
deferred = {
|
||||||
|
raw = '[>]',
|
||||||
|
rendered = '⛝ ',
|
||||||
|
highlight = 'RenderMarkdownWarn',
|
||||||
|
scope_highlight = nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -38,6 +38,13 @@ return {
|
|||||||
ui = {
|
ui = {
|
||||||
-- Disable the UI features and let render-markdown.nvim handle it.
|
-- Disable the UI features and let render-markdown.nvim handle it.
|
||||||
enable = false,
|
enable = false,
|
||||||
|
-- Even with UI disabled, this determines the order of checkbox states for the smart action.
|
||||||
|
checkboxes = {
|
||||||
|
[" "] = { char = "☐", hl_group = "ObsidianTodo" },
|
||||||
|
["x"] = { char = "✔", hl_group = "ObsidianDone" },
|
||||||
|
["/"] = { char = "⛋", hl_group = "ObsidianDone" },
|
||||||
|
[">"] = { char = "⛝", hl_group = "ObsidianDone" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user