diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-07 17:15:10 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-07 18:36:02 +0200 |
| commit | f2c4081c9251e6f688c206bb90c8f646daaa640c (patch) | |
| tree | ef5f5c70d38d0ad21135f784904c670462a17641 /.config/nvim/plugin | |
| parent | a8e96131b873729c40644c34fc7ac060aa50168c (diff) | |
| download | dotfiles-f2c4081c9251e6f688c206bb90c8f646daaa640c.tar.gz dotfiles-f2c4081c9251e6f688c206bb90c8f646daaa640c.zip | |
feat(nvim): add markdown rendering with `render-markdown.nvim`
See https://github.com/MeanderingProgrammer/render-markdown.nvim
- Don't set `'colorcolumn'` and `'conceallevel'` in markdown ftplugin
- Treesitter plugin doesn't install the markdown and markdown_inline
parsers. `50-markdown.lua` does it instead, so that it is
self-contained. It also installs extra parsers it needs: yaml, html
and latex.
- Remove markdown highlight adjustments in `50-colors.lua`
- Remove `markdown/injections.scm` that was disabling treesitter
highlighting inside fenced code blocks.
Diffstat (limited to '.config/nvim/plugin')
| -rw-r--r-- | .config/nvim/plugin/10-treesitter.lua | 2 | ||||
| -rw-r--r-- | .config/nvim/plugin/50-colors.lua | 14 | ||||
| -rw-r--r-- | .config/nvim/plugin/50-markdown.lua | 24 |
3 files changed, 24 insertions, 16 deletions
diff --git a/.config/nvim/plugin/10-treesitter.lua b/.config/nvim/plugin/10-treesitter.lua index 4602519..aa68fdc 100644 --- a/.config/nvim/plugin/10-treesitter.lua +++ b/.config/nvim/plugin/10-treesitter.lua @@ -11,8 +11,6 @@ require("nvim-treesitter").install({ "ini", "json", "lua", - "markdown", - "markdown_inline", "readline", "vim", "vimdoc", diff --git a/.config/nvim/plugin/50-colors.lua b/.config/nvim/plugin/50-colors.lua index f713a74..4d9774e 100644 --- a/.config/nvim/plugin/50-colors.lua +++ b/.config/nvim/plugin/50-colors.lua @@ -36,20 +36,6 @@ local function adjust_highlight() vim.api.nvim_set_hl(0, "Cursorline", { bg = "#043624" }) vim.api.nvim_set_hl(0, "NormalFloat", { bg = solarized_colors.base02 }) end - - -- Markdown highlight - if vim.o.background == "light" then - vim.api.nvim_set_hl(0, "@markup.raw", { bg = solarized_colors.base2, update = true }) - elseif vim.o.background == "dark" then - vim.api.nvim_set_hl(0, "@markup.raw", { bg = solarized_colors.base02, update = true }) - end - vim.api.nvim_set_hl(0, "@markup.raw.block", { fg = solarized_colors.cyan, update = true }) - vim.api.nvim_set_hl(0, "@markup.heading.1", { link = "@markup.heading" }) - vim.api.nvim_set_hl(0, "@markup.heading.2", { link = "@markup.heading" }) - vim.api.nvim_set_hl(0, "@markup.heading.3", { link = "@markup.heading" }) - vim.api.nvim_set_hl(0, "@markup.heading.4", { link = "@markup.heading" }) - vim.api.nvim_set_hl(0, "@markup.heading.5", { link = "@markup.heading" }) - vim.api.nvim_set_hl(0, "@markup.heading.6", { link = "@markup.heading" }) end end diff --git a/.config/nvim/plugin/50-markdown.lua b/.config/nvim/plugin/50-markdown.lua new file mode 100644 index 0000000..d033d32 --- /dev/null +++ b/.config/nvim/plugin/50-markdown.lua @@ -0,0 +1,24 @@ +-- +-- Markdown rendering plugin +-- +-- Uses `render-markdown`, see https://github.com/MeanderingProgrammer/render-markdown.nvim + +vim.pack.add({ + "https://github.com/nvim-treesitter/nvim-treesitter", + "https://github.com/nvim-tree/nvim-web-devicons", + "https://github.com/MeanderingProgrammer/render-markdown.nvim", +}) + +require("nvim-treesitter").install({ + "html", + "latex", + "markdown", + "markdown_inline", + "yaml", +}) + +require("render-markdown").setup({ + heading = { width = "block", min_width = 120 }, + code = { position = "center", sign = false, width = "block", min_width = 60, left_margin = 2 }, + dash = { width = 120 }, +}) |
