Added Markdown inline render Neovim

This commit is contained in:
Fabio Scotto di Santolo
2025-08-19 11:28:25 +02:00
parent 0c7c857e76
commit 0ed003b060
8 changed files with 120 additions and 62 deletions

View File

@@ -1,3 +1,5 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")
require("config.markdown")
require("config.treesitter")
require("user.utils")

View File

@@ -1,18 +1,17 @@
{
"LazyVim": { "branch": "main", "commit": "25abbf546d564dc484cf903804661ba12de45507" },
"SchemaStore.nvim": { "branch": "main", "commit": "64f345511dc43c78170b942ca56bfbaed160cb78" },
"SchemaStore.nvim": { "branch": "main", "commit": "e906ac3ed0bd273781759e7635b5b824393c925c" },
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "211dc3649f775c5a390e9fae07bf20d985f8dcf2" },
"catppuccin": { "branch": "main", "commit": "9a9a875e979fe9d2b42423d056f944dd286d0280" },
"clangd_extensions.nvim": { "branch": "main", "commit": "b67cc417d9020fb4b83d46662351b4d16894905e" },
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
"conform.nvim": { "branch": "master", "commit": "26ebdcfb4f3c9d33d6f81c9534037bd5172b6d65" },
"dial.nvim": { "branch": "master", "commit": "78bd73aaf2b9c8f80715a878feaf56f7ffa8b6ff" },
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"fzf-lua": { "branch": "main", "commit": "13513d6535a5dbc06b590d4c7fdeef1d5e18a5d4" },
"fzf-lua": { "branch": "main", "commit": "d6e899e8dfdaf47bf849c0875ca3ca0e5a0e0d12" },
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
"glow.nvim": { "branch": "main", "commit": "5d5954b2f22e109d4a6eba8b2618c5b96e4ee7a2" },
"grug-far.nvim": { "branch": "main", "commit": "385d1949dc21d0c39e7a74b4f4a25da18817bc86" },
"hardtime.nvim": { "branch": "main", "commit": "6d7664d5bdfaea44c5f50b29f5239fab7b00c273" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
@@ -26,6 +25,7 @@
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"mini.ai": { "branch": "main", "commit": "1cd4f021a05c29acd4ab511c0981da14217daf38" },
"mini.icons": { "branch": "main", "commit": "b8f6fa6f5a3fd0c56936252edcd691184e5aac0c" },
"mini.nvim": { "branch": "main", "commit": "c5f2b25bfffbfb793602fa091fca0074871d30fe" },
"mini.pairs": { "branch": "main", "commit": "1e1ca3f60f58d4050bf814902b472eec9963a5dd" },
"multicursors.nvim": { "branch": "main", "commit": "72225ea9e4443c3f4b9df91d0193e07c4ee8d382" },
"neo-tree.nvim": { "branch": "main", "commit": "46fa0c22ca39e05fe15744102d21feb07fe9a94a" },
@@ -38,7 +38,7 @@
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-lint": { "branch": "master", "commit": "7ef127aaede2a4d5ad8df8321e2eb4e567f29594" },
"nvim-lspconfig": { "branch": "master", "commit": "a6dbc91d9ae373a87bcd9e3c15853e309691c39b" },
"nvim-lspconfig": { "branch": "master", "commit": "61fdd3a8609071ce44519e405f3424d84ec94d9d" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" },
@@ -46,7 +46,7 @@
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"refactoring.nvim": { "branch": "master", "commit": "74b608dfee827c2372250519d433cc21cb083407" },
"render-markdown.nvim": { "branch": "main", "commit": "e5c3c500d66e9aaf04c116cdfdb0b040d56a1521" },
"render-markdown.nvim": { "branch": "main", "commit": "ec74afa498b6ce3ee686131adf2b3941b713f307" },
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
@@ -55,5 +55,5 @@
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
"venv-selector.nvim": { "branch": "regexp", "commit": "c2d888f416c3572c27ab9ef936443ce7cd98762b" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
"yazi.nvim": { "branch": "main", "commit": "ddb52bd5c1067643071b42c0d0934f4d48c8774a" }
"yazi.nvim": { "branch": "main", "commit": "aa8ca37640375e26202330053de10af275209f6c" }
}

View File

@@ -15,9 +15,6 @@ map({ "n", "v" }, "<leader>y", [["+y]], { noremap = true, silent = true, desc =
-- Paste from system clipboard
map("n", "<leader>p", [["+p]], { noremap = true, silent = true, desc = "Paste from system clipboard" })
-- Markdown menu
map("n", "<leader>M", [["+M]], { noremap = true, silent = true, desc = "Markdown" })
vim.keymap.set("n", "<leader>cc", function()
local file1 = vim.fn.expand("%")

View File

@@ -0,0 +1,60 @@
require("render-markdown").setup({
heading = { position = "inline" },
quote = { repeat_linebreak = true },
win_options = {
showbreak = {
default = "",
rendered = " ",
},
breakindent = {
default = false,
rendered = true,
},
breakindentopt = {
default = "",
rendered = "",
},
},
checkbox = {
unchecked = { icon = "" },
checked = { icon = "" },
},
code = {
position = "right",
width = "block",
right_pad = 10,
},
latex = {
enabled = true,
render_modes = false,
converter = "latex2text",
highlight = "RenderMarkdownMath",
position = "above",
top_pad = 0,
bottom_pad = 0,
},
link = {
custom = {
c = {
pattern = "%.[ch]$",
icon = "",
},
golang = {
pattern = "%.go$",
icon = "",
},
python = {
pattern = "%.py$",
icon = "󰌠 ",
},
lua = {
pattern = "%.lua$",
icon = "",
},
-- shell = {
-- pattern = "%.[sh|zsh]$",
-- icon = " ",
-- },
},
},
})

View File

@@ -30,9 +30,9 @@ opt.termguicolors = true
opt.clipboard = "unnamedplus"
-- Indentation
opt.softtabstop = 8
opt.shiftwidth = 8
opt.tabstop = 8
-- opt.softtabstop = 8
-- opt.shiftwidth = 8
-- opt.tabstop = 8
opt.expandtab = true
opt.smartindent = true

View File

@@ -1,28 +1,54 @@
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = {
"bash",
"c",
"lua",
"bash",
"go",
"gomod",
"gowork",
"gosum",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"org",
"zig",
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (or "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enabled = true,
},
incremental_selection = {
enabled = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = {},
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
})

View File

@@ -2,5 +2,6 @@ return {
"m4xshen/hardtime.nvim",
lazy = false,
dependencies = { "MunifTanjim/nui.nvim" },
enabled = false,
opts = {},
}

View File

@@ -1,37 +1,9 @@
return {
-- Browser preview plugin
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && yarn install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
vim.g.mkdp_auto_start = 0
vim.g.mkdp_browser = "firefox" -- use your preferred browser
vim.g.mkdp_sync_scroll_type = "middle"
end,
ft = { "markdown" },
keys = {
{
"<leader>Mp",
"<cmd>MarkdownPreviewToggle<CR>",
desc = "Preview Markdown (Browser)",
},
},
},
-- Terminal-based preview with Glow
{
"ellisonleao/glow.nvim",
config = true, -- uses default config
cmd = "Glow",
ft = { "markdown" },
keys = {
{
"<leader>Mg",
"<cmd>Glow<CR>",
desc = "Preview Markdown (Glow)",
},
},
},
"MeanderingProgrammer/render-markdown.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
}