3 "MeanderingProgrammer/render-markdown.nvim",
6 "nvim-treesitter/nvim-treesitter",
7 "nvim-tree/nvim-web-devicons",
10 -- Open a right split showing the SAME buffer, render only in that right window
14 local cur = vim.api.nvim_get_current_buf()
17 vim.api.nvim_win_set_buf(0, cur)
19 -- Optional: fix the width of the preview pane (comment out if not desired)
20 -- vim.cmd("vertical resize 88")
22 require("render-markdown").enable() -- enable only in the right window
24 desc = "Markdown: open rendered view (right split)",
27 -- Disable rendering in the current window and close the split
31 require("render-markdown").disable()
32 -- Close the right split if you're currently in it
33 if #vim.api.nvim_list_wins() > 1 then
34 vim.cmd("wincmd l | close")
37 desc = "Markdown: close rendered view",
40 -- Toggle inline rendering in the current window (no split)
44 vim.cmd("RenderMarkdown toggle") -- built-in toggle command
46 desc = "Markdown: toggle inline render",
50 -- Good starting defaults; tweak as you like
54 icons = { "▎", "▎", "▎", "▎", "▎", "▎" },
56 bullet = { enabled = true },
57 checkbox = { enabled = true },
58 code = { enabled = true, sign = true }, -- prettify fenced code blocks
59 link = { enabled = true },
60 table = { enabled = true },
62 config = function(_, opts)
63 require("render-markdown").setup(opts)
65 -- Nice conceal defaults for markdown buffers
66 vim.api.nvim_create_autocmd("FileType", {
67 pattern = { "markdown" },
68 callback = function(ev)
69 local win = vim.fn.bufwinid(ev.buf)
71 vim.api.nvim_win_set_option(win, "conceallevel", 2)
72 vim.api.nvim_win_set_option(win, "concealcursor", "nc")