mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-11-03 20:22:21 +00:00 
			
		
		
		
	languages/markdown: add render-markdown.nvim as an extension
		
	This commit is contained in:
		
					parent
					
						
							
								ba3173d363
							
						
					
				
			
			
				commit
				
					
						4905fe04e0
					
				
			
		
					 4 changed files with 62 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -3,12 +3,16 @@
 | 
			
		|||
[NotAShelf](https://github.com/notashelf):
 | 
			
		||||
 | 
			
		||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
 | 
			
		||||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
 | 
			
		||||
 | 
			
		||||
- Add [typst-preview.nvim] under
 | 
			
		||||
  `languages.typst.extensions.typst-preview-nvim`.
 | 
			
		||||
 | 
			
		||||
- Add a search widget to the options page in the nvf manual.
 | 
			
		||||
 | 
			
		||||
- Add [render-markdown.nvim] under
 | 
			
		||||
  `languages.markdown.extensions.render-markdown-nvim`
 | 
			
		||||
 | 
			
		||||
[amadaluzia](https://github.com/amadaluzia):
 | 
			
		||||
 | 
			
		||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							| 
						 | 
				
			
			@ -1694,6 +1694,22 @@
 | 
			
		|||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "plugin-render-markdown-nvim": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1735525479,
 | 
			
		||||
        "narHash": "sha256-ncFqBv0JITX3pTsLON+HctLUaKXhLRMBUrRWmI8KOSA=",
 | 
			
		||||
        "owner": "MeanderingProgrammer",
 | 
			
		||||
        "repo": "render-markdown.nvim",
 | 
			
		||||
        "rev": "6fbd1491abc104409f119685de5353c35c97c005",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "MeanderingProgrammer",
 | 
			
		||||
        "repo": "render-markdown.nvim",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "plugin-rose-pine": {
 | 
			
		||||
      "flake": false,
 | 
			
		||||
      "locked": {
 | 
			
		||||
| 
						 | 
				
			
			@ -2170,6 +2186,7 @@
 | 
			
		|||
        "plugin-precognition-nvim": "plugin-precognition-nvim",
 | 
			
		||||
        "plugin-project-nvim": "plugin-project-nvim",
 | 
			
		||||
        "plugin-registers": "plugin-registers",
 | 
			
		||||
        "plugin-render-markdown-nvim": "plugin-render-markdown-nvim",
 | 
			
		||||
        "plugin-rose-pine": "plugin-rose-pine",
 | 
			
		||||
        "plugin-rtp-nvim": "plugin-rtp-nvim",
 | 
			
		||||
        "plugin-run-nvim": "plugin-run-nvim",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -488,6 +488,11 @@
 | 
			
		|||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    plugin-render-markdown-nvim = {
 | 
			
		||||
      url = "github:MeanderingProgrammer/render-markdown.nvim";
 | 
			
		||||
      flake = false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # Minimap
 | 
			
		||||
    plugin-minimap-vim = {
 | 
			
		||||
      url = "github:wfxr/minimap.vim";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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})
 | 
			
		||||
      '';
 | 
			
		||||
    })
 | 
			
		||||
  ]);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue