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 | 0c83c6f7401cabf00d9135bdf54b63e82276fea2 (patch) | |
| tree | 8cb9ce569fee8b74e7666c0c2e864916d4d2e43c /plugin | |
| parent | 83ca0c687a5267004099480c5e66e884b515e042 (diff) | |
| download | nvim-config-0c83c6f7401cabf00d9135bdf54b63e82276fea2.tar.gz nvim-config-0c83c6f7401cabf00d9135bdf54b63e82276fea2.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 'plugin')
| -rw-r--r-- | plugin/10-treesitter.lua | 2 | ||||
| -rw-r--r-- | plugin/50-colors.lua | 14 | ||||
| -rw-r--r-- | plugin/50-markdown.lua | 24 |
3 files changed, 24 insertions, 16 deletions
diff --git a/plugin/10-treesitter.lua b/plugin/10-treesitter.lua index 4602519..aa68fdc 100644 --- a/plugin/10-treesitter.lua +++ b/plugin/10-treesitter.lua @@ -11,8 +11,6 @@ require("nvim-treesitter").install({ "ini", "json", "lua", - "markdown", - "markdown_inline", "readline", "vim", "vimdoc", diff --git a/plugin/50-colors.lua b/plugin/50-colors.lua index f713a74..4d9774e 100644 --- a/plugin/50-colors.lua +++ b/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/plugin/50-markdown.lua b/plugin/50-markdown.lua new file mode 100644 index 0000000..d033d32 --- /dev/null +++ b/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 }, +}) |
