Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add render-markdown.nvim for md workflow #1336

Merged
merged 4 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lua/keymap/lang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ local map_cr = bind.map_cr
-- local map_callback = bind.map_callback

local plug_map = {
-- Plugin render-markdown.nvim
["n|<F1>"] = map_cr("RenderMarkdown toggle")
:with_noremap()
:with_silent()
:with_desc("tool: toggle markdown preview within nvim"),
-- Plugin MarkdownPreview
["n|<F12>"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"),
}
Expand Down
21 changes: 21 additions & 0 deletions lua/modules/configs/lang/render-markdown.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
return function()
require("modules.utils").load_plugin("render-markdown", {
-- Whether Markdown should be rendered by default or not
enabled = true,
-- Maximum file size (in MB) that this plugin will attempt to render
-- Any file larger than this will effectively be ignored
max_file_size = 2.0,
-- Milliseconds that must pass before updating marks, updates occur
-- within the context of the visible window, not the entire buffer
debounce = 100,
-- Vim modes that will show a rendered view of the markdown file
-- All other modes will be uneffected by this plugin
render_modes = { "n", "c", "t" },
-- This enables hiding any added text on the line the cursor is on
-- This does have a performance penalty as we must listen to the 'CursorMoved' event
anti_conceal = { enabled = true },
-- The level of logs to write to file: vim.fn.stdpath('state') .. '/render-markdown.log'
-- Only intended to be used for plugin development / debugging
log_level = "error",
})
end
1 change: 1 addition & 0 deletions lua/modules/configs/ui/catppuccin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ return function()
overseer = false,
pounce = false,
rainbow_delimiters = true,
render_markdown = true,
sandwich = false,
semantic_tokens = true,
symbols_outline = false,
Expand Down
9 changes: 9 additions & 0 deletions lua/modules/plugins/lang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ lang["Saecki/crates.nvim"] = {
config = require("lang.crates"),
dependencies = { "nvim-lua/plenary.nvim" },
}
lang["MeanderingProgrammer/render-markdown.nvim"] = {
lazy = true,
ft = "markdown",
config = require("lang.render-markdown"),
dependencies = {
"nvim-tree/nvim-web-devicons",
"nvim-treesitter/nvim-treesitter",
},
}
lang["iamcco/markdown-preview.nvim"] = {
lazy = true,
ft = "markdown",
Expand Down