languages/markdown: add render-markdown.nvim as an extension (#517)
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-html) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-json) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-manpages) (push) Has been cancelled
Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Check for typos in the source tree / check-typos (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled

This commit is contained in:
raf 2024-12-31 07:02:13 +03:00 committed by GitHub
commit 8febf44422
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 62 additions and 4 deletions

View file

@ -4,13 +4,14 @@
lib,
...
}: let
inherit (builtins) attrNames concatLists;
inherit (builtins) attrNames;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.lists) isList;
inherit (lib.lists) isList concatLists;
inherit (lib.types) bool enum either package listOf str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.markdown;
defaultServer = "marksman";
@ -98,6 +99,29 @@ in {
description = "Extra filetypes to format with the Markdown formatter";
};
};
extensions = {
render-markdown-nvim = {
enable =
mkEnableOption ""
// {
description = ''
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
Inline Markdown rendering with [render-markdown.nvim]
'';
};
setupOpts = mkPluginSetupOption "render-markdown" {
auto_override_publish_diagnostics = mkOption {
description = "Automatically override the publish_diagnostics handler";
type = bool;
default = true;
};
};
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -115,5 +139,13 @@ in {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
})
# Extensions
(mkIf cfg.extensions.render-markdown-nvim.enable {
vim.startPlugins = ["render-markdown-nvim"];
vim.pluginRC.render-markdown-nvim = entryAnywhere ''
require("render-markdown").setup(${toLuaObject cfg.extensions.render-markdown-nvim.setupOpts})
'';
})
]);
}