mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-28 11:30:06 +02:00
plugins/markdown-preview: switch to settings option
This commit is contained in:
parent
c60fc8ec3e
commit
44a31bd1fe
1 changed files with 177 additions and 188 deletions
|
@ -12,124 +12,105 @@ with helpers.vim-plugin;
|
||||||
originalName = "markdown-preview.nvim";
|
originalName = "markdown-preview.nvim";
|
||||||
defaultPackage = pkgs.vimPlugins.markdown-preview-nvim;
|
defaultPackage = pkgs.vimPlugins.markdown-preview-nvim;
|
||||||
globalPrefix = "mkdp_";
|
globalPrefix = "mkdp_";
|
||||||
deprecateExtraConfig = true;
|
|
||||||
|
|
||||||
maintainers = [maintainers.GaetanLepage];
|
maintainers = [maintainers.GaetanLepage];
|
||||||
|
|
||||||
options = {
|
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||||
autoStart = mkDefaultOpt {
|
deprecateExtraConfig = true;
|
||||||
global = "auto_start";
|
optionsRenamedToSettings = [
|
||||||
type = types.bool;
|
"autoStart"
|
||||||
description = ''
|
"autoClose"
|
||||||
|
"refreshSlow"
|
||||||
|
"commandForGlobal"
|
||||||
|
"openToTheWorld"
|
||||||
|
"openIp"
|
||||||
|
"browser"
|
||||||
|
"echoPreviewUrl"
|
||||||
|
"browserFunc"
|
||||||
|
"previewOptions"
|
||||||
|
"markdownCss"
|
||||||
|
"highlightCss"
|
||||||
|
"port"
|
||||||
|
"pageTitle"
|
||||||
|
"theme"
|
||||||
|
];
|
||||||
|
imports = [
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
["plugins" "markdown-preview" "fileTypes"]
|
||||||
|
["plugins" "markdown-preview" "settings" "filetypes"]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
auto_start = helpers.defaultNullOpts.mkBool false ''
|
||||||
Open the preview window after entering the markdown buffer.
|
Open the preview window after entering the markdown buffer.
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
autoClose = mkDefaultOpt {
|
auto_close = helpers.defaultNullOpts.mkBool true ''
|
||||||
global = "auto_close";
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Auto close current preview window when change from markdown buffer to another buffer.
|
Auto close current preview window when change from markdown buffer to another buffer.
|
||||||
|
|
||||||
Default: `true`
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
refreshSlow = mkDefaultOpt {
|
refresh_slow = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "refresh_slow";
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Refresh markdown when save the buffer or leave from insert mode, default false is auto
|
Refresh markdown when save the buffer or leave from insert mode, default false is auto
|
||||||
refresh markdown as you edit or move the cursor.
|
refresh markdown as you edit or move the cursor.
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
commandForGlobal = mkDefaultOpt {
|
command_for_global = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "command_for_global";
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Enable markdown preview for all files (by default, the plugin is only enabled for markdown
|
Enable markdown preview for all files (by default, the plugin is only enabled for markdown
|
||||||
files).
|
files).
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
openToTheWorld = mkDefaultOpt {
|
open_to_the_world = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "open_to_the_world";
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Make the preview server available to others in your network.
|
Make the preview server available to others in your network.
|
||||||
By default, the server listens on localhost (127.0.0.1).
|
By default, the server listens on localhost (127.0.0.1).
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
openIp = mkDefaultOpt {
|
open_ip = helpers.defaultNullOpts.mkStr "" ''
|
||||||
global = "open_ip";
|
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
Custom IP used to open the preview page.
|
Custom IP used to open the preview page.
|
||||||
This can be useful when you work in remote vim and preview on local browser.
|
This can be useful when you work in remote vim and preview on local browser.
|
||||||
For more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9.
|
For more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9.
|
||||||
|
|
||||||
Default: ""
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
browser = mkDefaultOpt {
|
browser = helpers.defaultNullOpts.mkStr "" ''
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
The browser to open the preview page.
|
The browser to open the preview page.
|
||||||
|
|
||||||
Default: ""
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
echoPreviewUrl = mkDefaultOpt {
|
echo_preview_url = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "echo_preview_url";
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Echo preview page url in command line when opening the preview page.
|
Echo preview page url in command line when opening the preview page.
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
browserFunc = mkDefaultOpt {
|
browser_func = helpers.defaultNullOpts.mkStr "" ''
|
||||||
global = "browser_func";
|
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
A custom vim function name to open preview page.
|
A custom vim function name to open preview page.
|
||||||
This function will receive url as param.
|
This function will receive url as param.
|
||||||
|
|
||||||
Default: ""
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
previewOptions = mkDefaultOpt {
|
preview_options =
|
||||||
global = "preview_options";
|
helpers.mkNullOrOption
|
||||||
default = {};
|
(
|
||||||
description = "Preview options";
|
types.submodule {
|
||||||
type = types.submodule {
|
|
||||||
freeformType = types.attrs;
|
freeformType = types.attrs;
|
||||||
options = let
|
|
||||||
mkEmptyListOfStr = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]";
|
|
||||||
in {
|
|
||||||
mkit = mkEmptyListOfStr "markdown-it options for render";
|
|
||||||
|
|
||||||
katex = mkEmptyListOfStr "katex options for math";
|
options = {
|
||||||
|
mkit = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
|
`markdown-it` options for render.
|
||||||
|
'';
|
||||||
|
|
||||||
uml = mkEmptyListOfStr "markdown-it-plantuml options";
|
katex = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
|
`katex` options for math.
|
||||||
|
'';
|
||||||
|
|
||||||
maid = mkEmptyListOfStr "mermaid options";
|
uml = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
|
`markdown-it-plantuml` options.
|
||||||
|
'';
|
||||||
|
|
||||||
disable_sync_scroll = helpers.defaultNullOpts.mkBool false "Disable sync scroll.";
|
maid = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
|
`mermaid` options.
|
||||||
|
'';
|
||||||
|
|
||||||
|
disable_sync_scroll = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Disable sync scroll.
|
||||||
|
'';
|
||||||
|
|
||||||
sync_scroll_type =
|
sync_scroll_type =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||||
|
@ -139,15 +120,19 @@ with helpers.vim-plugin;
|
||||||
- "middle": The cursor position is always shown at the middle of the preview page.
|
- "middle": The cursor position is always shown at the middle of the preview page.
|
||||||
- "top": The vim top viewport is always shown at the top of the preview page.
|
- "top": The vim top viewport is always shown at the top of the preview page.
|
||||||
- "relative": The cursor position is always shown at the relative positon of the preview page.
|
- "relative": The cursor position is always shown at the relative positon of the preview page.
|
||||||
|
|
||||||
Default: "middle"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
hide_yaml_meta = helpers.defaultNullOpts.mkBool true "Hide yaml metadata.";
|
hide_yaml_meta = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Hide yaml metadata.
|
||||||
|
'';
|
||||||
|
|
||||||
sequence_diagrams = mkEmptyListOfStr "js-sequence-diagrams options";
|
sequence_diagrams = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
|
`js-sequence-diagrams` options.
|
||||||
|
'';
|
||||||
|
|
||||||
flowchart_diagrams = mkEmptyListOfStr "flowcharts diagrams options";
|
flowchart_diagrams = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
|
`flowcharts` diagrams options.
|
||||||
|
'';
|
||||||
|
|
||||||
content_editable = helpers.defaultNullOpts.mkBool false ''
|
content_editable = helpers.defaultNullOpts.mkBool false ''
|
||||||
Content editable from the preview page.
|
Content editable from the preview page.
|
||||||
|
@ -157,70 +142,74 @@ with helpers.vim-plugin;
|
||||||
Disable filename header for the preview page.
|
Disable filename header for the preview page.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
toc = mkEmptyListOfStr "Toc options";
|
toc = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
};
|
Toc options.
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
markdownCss = mkDefaultOpt {
|
|
||||||
global = "markdown_css";
|
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
Custom markdown style.
|
|
||||||
Must be an absolute path like "/Users/username/markdown.css" or
|
|
||||||
`expand('~/markdown.css')`.
|
|
||||||
|
|
||||||
Default: ""
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
"Preview options";
|
||||||
|
|
||||||
highlightCss = mkDefaultOpt {
|
markdown_css = helpers.defaultNullOpts.mkStr "" ''
|
||||||
global = "highlight_css";
|
Custom markdown style.
|
||||||
type = types.str;
|
Must be an absolute path like `"/Users/username/markdown.css"` or
|
||||||
description = ''
|
`{__raw = "vim.fn.expand('~/markdown.css')";}`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
highlight_css = helpers.defaultNullOpts.mkStr "" ''
|
||||||
Custom highlight style.
|
Custom highlight style.
|
||||||
Must be an absolute path like "/Users/username/highlight.css" or
|
Must be an absolute path like "/Users/username/highlight.css" or
|
||||||
`expand('~/highlight.css')`.
|
`{__raw = "vim.fn.expand('~/highlight.css')";}`.
|
||||||
|
|
||||||
Default: ""
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
port = mkDefaultOpt {
|
port = helpers.defaultNullOpts.mkStr "" ''
|
||||||
type = types.ints.positive;
|
|
||||||
apply = v: helpers.ifNonNull' v (toString v);
|
|
||||||
description = ''
|
|
||||||
Custom port to start server or empty for random.
|
Custom port to start server or empty for random.
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
pageTitle = mkDefaultOpt {
|
page_title = helpers.defaultNullOpts.mkStr "「\$\{name}」" ''
|
||||||
global = "page_title";
|
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
Preview page title.
|
Preview page title.
|
||||||
`$${name}` will be replaced with the file name.
|
`$${name}` will be replaced with the file name.
|
||||||
|
|
||||||
Default: "「\$\{name}」"
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
fileTypes = mkDefaultOpt {
|
images_path = helpers.defaultNullOpts.mkStr "" ''
|
||||||
global = "file_types";
|
Use a custom location for images.
|
||||||
type = with types; listOf str;
|
|
||||||
description = ''
|
|
||||||
Recognized filetypes. These filetypes will have MarkdownPreview... commands.
|
|
||||||
|
|
||||||
Default: `["markdown"]`
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
theme = mkDefaultOpt {
|
filetypes = helpers.defaultNullOpts.mkListOf types.str ''["markdown"]'' ''
|
||||||
type = types.enum ["dark" "light"];
|
Recognized filetypes. These filetypes will have `MarkdownPreview...` commands.
|
||||||
description = ''
|
'';
|
||||||
|
|
||||||
|
theme = helpers.mkNullOrOption (types.enum ["dark" "light"]) ''
|
||||||
Default theme (dark or light).
|
Default theme (dark or light).
|
||||||
By default the theme is define according to the preferences of the system.
|
By default the theme is define according to the preferences of the system.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
combine_preview = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Combine preview window.
|
||||||
|
If enable it will reuse previous opened preview window when you preview markdown file.
|
||||||
|
Ensure to set `auto_close = false` if you have enable this option.
|
||||||
|
'';
|
||||||
|
|
||||||
|
combine_preview_auto_refresh = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Auto refetch combine preview contents when change markdown buffer only when
|
||||||
|
`combine_preview` is `true`.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
settingsExample = {
|
||||||
|
auto_start = true;
|
||||||
|
auto_close = true;
|
||||||
|
browser = "firefox";
|
||||||
|
echo_preview_url = true;
|
||||||
|
preview_options = {
|
||||||
|
disable_sync_scroll = true;
|
||||||
|
sync_scroll_type = "middle";
|
||||||
|
disable_filename = true;
|
||||||
|
};
|
||||||
|
markdown_css = "/Users/username/markdown.css";
|
||||||
|
highlight_css.__raw = "vim.fn.expand('~/highlight.css')";
|
||||||
|
port = "8080";
|
||||||
|
page_title = "「\$\{name}」";
|
||||||
|
theme = "dark";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue