Markdown Notes (mdnotes or Mdn) aims to improve the Neovim Markdown note-taking experience by providing features like better Wikilink support, adding/removing hyperlinks to images/files/URLs, file history, asset management, referencing, backlinks, and formatting. All this without relying on any LSP but using one is recommended.
Read the documentation with :h mdnotes.txt.
:Mdn open.:Mdn home.:Mdn journal.[[link]] or [[link#Section]]) with :Mdn open_wikilink.:Mdn toggle_hyperlink which pastes your copied hyperlink over the selected text or removes it.:Mdn show_backlinks or to show the backlinks of a Wikilink by hovering over the link and executing the same command.:Mdn toggle_outliner. Make sure to exit afterwards by re-toggling.:Mdn insert_image or :Mdn insert_file which creates the appropriate link and copies or moves the image to your assets folder. Requires xclip or wl-clipboard for Linux.:Mdn cleanup_unused_assets to easily cleanup assets that you no longer use.:Mdn go_back and :Mdn go_forward.:Mdn bold/italic/inline_code/strikethrough_toggle.:Mdn rename_link_references.:Mdn insert_date (in a customiseable format) when using your journal.{
"ymich9963/mdnotes.nvim",
opts = {
assets_path = "assets", -- your assets path for assets related commands
index_file = "MAIN.md", -- your index file for :Mdn home
journal_file = "JOURNAL.md",-- your journal file for :Mdn journal
}
}
{
index_file = "",
journal_file = "",
assets_path = "",
insert_file_behaviour = "copy", -- "copy" or "move" files when inserting from clipboard
overwrite_behaviour = "error", -- "overwrite" or "error" when finding assset file conflicts
open_behaviour = "buffer", -- "buffer" or "tab" to open when following links
date_format = "%a %d %b %Y" -- date format based on :h strftime()
}
I've listed some recommended keymaps and settings below for a great experience with mdnotes. They are not applied by default and therefore have to be mapped manually. All suggestions here should ideally be in an after/ftplugin/markdown.lua file so that they are specific to Markdown files.
Here are some recommended keymaps for mdnotes,
vim.keymap.set("n", "gf", ":Mdn open_wikilink<CR>", { desc = "Open markdown file from Wikilink" })
vim.keymap.set({"v", "n"}, "<C-K>", ":Mdn hyperlink_toggle<CR>", { desc = "Toggle hyperlink" })
vim.keymap.set("n", "<Left>", ":Mdn go_back<CR>", { desc = "Go to back to previously visited Markdown buffer" })
vim.keymap.set("n", "<Right>", ":Mdn go_forward<CR>", { desc = "Go to next visited Markdown buffer" })
vim.keymap.set({"v", "n"}, "<C-B>", ":Mdn bold_toggle<CR>", { desc = "Toggle bold formatting" })
vim.keymap.set({"v", "n"}, "<C-I>", ":Mdn italics_toggle<CR>", { desc = "Toggle italics formatting" })
If you really like outliner mode and want to indent entire blocks then these remaps are very helpful,
vim.keymap.set("v", "<", "<gv", { desc = "Indent left and reselect" }) -- Better indenting in visual mode
vim.keymap.set("v", ">", ">gv", { desc = "Indent right and reselect" })
If you are on Windows then setting this option will allow you to use the build in <C-x> <C-f> file completion,
vim.opt.isfname:remove('[', ']') -- To enable path completion on Windows <C-x> <C-f>
These other two settings are for enabling wrapping only in Markdown files, and to disable the LSP diagnostics if they annoy you.
vim.wo.wrap = true -- Enable wrap for current .md window
vim.diagnostic.enable(false, { bufnr = 0 }) -- Disable diagnostics for current .md buffer
The main reason I started this project was dissatisfaction with MD LSPs at the time, and I really wanted to use Neovim as my notes editor. It is recommended to use LSPs with mdnotes since I'm trying to work with the LSPs and to not try to create something from scratch. So far certain LSP features haven't been working for me fully, but I do recommend markdown-oxide and marksman.