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

@@ -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 = {},
}