OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
main @ 424 LINES
 
[ HISTORY ]  [ UP ]
 

{lib, ...}: let
  inherit (lib) mkOption mkEnableOption;
  inherit (lib.types) str nullOr bool enum listOf int float attrsOf submodule eith
er;
  inherit (lib.nvim.types) mkPluginSetupOption luaInline;

  # All possible Neovim modes
  neovimModes = [
    "n"
    "no"
    "nov"
    "noV"
    "noCTRL-v"
    "niI"
    "niR"
    "niV"
    "nt"
    "ntT"
    "v"
    "vs"
    "V"
    "Vs"
    "CTRL-V"
    "CTRL-Vs"
    "s"
    "S"
    "CTRL-S"
    "i"
    "ic"
    "ix"
    "R"
    "Rc"
    "Rx"
    "Rv"
    "Rvc"
    "Rvx"
    "c"
    "cr"
    "cv"
    "cvr"
    "r"
    "rm"
    "r?"
    "!"
    "t"
  ];

  # Preset options
  presetOptions = enum ["obsidian" "lazy" "none"];

  # Log level options
  logLevelOptions = enum ["error" "warn" "info" "debug" "trace"];

  # Anti-conceal ignore options submodule
  antiConcealIgnoreOptions = submodule {
    options = {
      head_icon = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where head icon anti-conceal behavior will be ignored
";
      };
      head_background = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where head background anti-conceal behavior will be i
gnored";
      };
      head_border = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where head border anti-conceal behavior will be ignor
ed";
      };
      code_language = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where code language anti-conceal behavior will be ign
ored";
      };
      code_background = mkOption {
        type = nullOr bool;
        default = true;
        description = "Whether to ignore code background anti-conceal behavior";
      };
      code_border = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where code border anti-conceal behavior will be ignor
ed";
      };
      dash = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where dash anti-conceal behavior will be ignored";
      };
      bullet = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where bullet anti-conceal behavior will be ignored";
      };
      check_icon = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where check icon anti-conceal behavior will be ignore
d";
      };
      check_scope = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where check scope anti-conceal behavior will be ignor
ed";
      };
      quote = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where quote anti-conceal behavior will be ignored";
      };
      table_border = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where table border anti-conceal behavior will be igno
red";
      };
      callout = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where callout anti-conceal behavior will be ignored";
      };
      link = mkOption {
        type = nullOr (listOf (enum neovimModes));
        default = null;
        description = "Modes where link anti-conceal behavior will be ignored";
      };
      sign = mkOption {
        type = nullOr bool;
        default = true;
        description = "Whether to ignore sign anti-conceal behavior";
      };
    };
  };

  # Injection options submodule
  injectionOptions = submodule {
    options = {
      enabled = mkOption {
        type = nullOr bool;
        default = null;
        description = "Whether this injection is enabled";
      };
      query = mkOption {
        type = luaInline;
        description = "Treesitter query for the injection";
      };
    };
  };

  headingWidthType = enum ["block" "full"];

  headingPositionType = enum ["right" "inline" "overlay"];
in {
  options.vim.notes.render-markdown-nvim = {
    enable = mkEnableOption "Inline markdown rendering";
    setupOpts = mkPluginSetupOption "render-markdown" {
      enabled = mkOption {
        type = bool;
        default = true;
        description = "Whether Markdown should be rendered by default";
      };

      render_modes = mkOption {
        type = listOf (enum neovimModes);
        default = ["n" "c" "t"];
        description = ''
          Vim modes that will show a rendered view of the markdown file.
          Individual components can be enabled for other modes.
        '';
      };

      max_file_size = mkOption {
        type = float;
        default = 10.0;
        description = "Maximum file size (in MB) that this plugin will attempt to 
render";
      };

      debounce = mkOption {
        type = int;
        default = 100;
        description = "Milliseconds that must pass before updating marks";
      };

      preset = mkOption {
        type = presetOptions;
        default = "none";
        description = "Pre-configured settings to mimic various target user experi
ences";
      };

      log_level = mkOption {
        type = logLevelOptions;
        default = "error";
        description = "The level of logs to write to file";
      };

      log_runtime = mkOption {
        type = bool;
        default = false;
        description = "Print runtime of main update method";
      };

      file_types = mkOption {
        type = listOf str;
        default = ["markdown"];
        description = "Filetypes this plugin will run on";
      };

      injections = mkOption {
        type = attrsOf injectionOptions;
        default = {
          gitcommit = {
            enabled = true;
            query = ''
              ((message) @injection.content
                  (#set! injection.combined)
                  (#set! injection.include-children)
                  (#set! injection.language "markdown"))
            '';
          };
        };
        description = "Language injections for known filetypes";
      };

      anti_conceal = {
        enabled = mkOption {
          type = bool;
          default = true;
          description = "Enable hiding added text on the cursor line";
        };

        ignore = mkOption {
          type = antiConcealIgnoreOptions;
          default = {
            code_background = true;
            sign = true;
          };
          description = "Elements to always show, ignoring anti-conceal behavior";
        };

        above = mkOption {
          type = int;
          default = 0;
          description = "Number of lines above cursor to show";
        };

        below = mkOption {
          type = int;
          default = 0;
          description = "Number of lines below cursor to show";
        };
      };

      padding = {
        highlight = mkOption {
          type = str;
          default = "Normal";
          description = "Highlight to use when adding whitespace";
        };
      };

      on = {
        attach = mkOption {
          type = nullOr luaInline;
          default = null;
          description = "Called when plugin initially attaches to a buffer";
        };

        render = mkOption {
          type = nullOr luaInline;
          default = null;
          description = "Called after plugin renders a buffer";
        };
      };

      latex = {
        enabled = mkOption {
          type = nullOr bool;
          default = null;
          description = "Whether LaTeX should be rendered";
        };

        render_modes = mkOption {
          type = nullOr bool;
          default = null;
          description = "Additional modes to render LaTeX";
        };

        converter = mkOption {
          type = nullOr str;
          default = null;
          description = "Executable used to convert latex formula to rendered unic
ode";
        };

        highlight = mkOption {
          type = nullOr str;
          default = null;
          description = "Highlight for LaTeX blocks";
        };

        top_pad = mkOption {
          type = nullOr int;
          default = null;
          description = "Amount of empty lines above LaTeX blocks";
        };

        bottom_pad = mkOption {
          type = nullOr int;
          default = null;
          description = "Amount of empty lines below LaTeX blocks";
        };
      };

      heading = {
        enabled = mkOption {
          type = nullOr bool;
          default = null;
          description = "Enable heading icon & background rendering";
        };

        render_modes = mkOption {
          type = nullOr bool;
          default = null;
          description = "Additional modes to render headings";
        };

        sign = mkOption {
          type = nullOr bool;
          default = null;
          description = "Turn on/off sign column related rendering";
        };

        icons = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Icons for different heading levels";
        };

        position = mkOption {
          type = nullOr headingPositionType;
          default = null;
          description = "How icons fill available space";
        };

        signs = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Signs added to the sign column if enabled";
        };

        width = mkOption {
          type = nullOr (either headingWidthType (listOf headingWidthType));
          default = null;
          description = "Width of the heading background";
        };

        left_margin = mkOption {
          type = nullOr (either float (listOf float));
          default = null;
          description = "Margin to add to left of headings";
        };

        left_pad = mkOption {
          type = nullOr (either float (listOf float));
          default = null;
          description = "Padding to add to left of headings";
        };

        right_pad = mkOption {
          type = nullOr (either float (listOf float));
          default = null;
          description = "Padding to add to right of headings when width is 'block'
";
        };

        min_width = mkOption {
          type = nullOr (either int (listOf int));
          default = null;
          description = "Minimum width for headings when width is 'block'";
        };

        border = mkOption {
          type = nullOr (either bool (listOf bool));
          default = null;
          description = "Add border above and below headings";
        };

        border_virtual = mkOption {
          type = nullOr bool;
          default = null;
          description = "Always use virtual lines for heading borders";
        };

        border_prefix = mkOption {
          type = nullOr bool;
          default = null;
          description = "Highlight border start using foreground highlight";
        };

        above = mkOption {
          type = nullOr str;
          default = null;
          description = "Character used above heading for border";
        };

        below = mkOption {
          type = nullOr str;
          default = null;
          description = "Character used below heading for border";
        };

        backgrounds = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Highlights for heading backgrounds per level";
        };

        foregrounds = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Highlights for heading and sign icons per level";
        };
      };
    };
  };
}

{lib, ...}: let
  inherit (lib) mkOption mkEnableOption;
  inherit (lib.types) str nullOr bool enum l
istOf int float attrsOf submodule either;
  inherit (lib.nvim.types) mkPluginSetupOpti
on luaInline;

  # All possible Neovim modes
  neovimModes = [
    "n"
    "no"
    "nov"
    "noV"
    "noCTRL-v"
    "niI"
    "niR"
    "niV"
    "nt"
    "ntT"
    "v"
    "vs"
    "V"
    "Vs"
    "CTRL-V"
    "CTRL-Vs"
    "s"
    "S"
    "CTRL-S"
    "i"
    "ic"
    "ix"
    "R"
    "Rc"
    "Rx"
    "Rv"
    "Rvc"
    "Rvx"
    "c"
    "cr"
    "cv"
    "cvr"
    "r"
    "rm"
    "r?"
    "!"
    "t"
  ];

  # Preset options
  presetOptions = enum ["obsidian" "lazy" "n
one"];

  # Log level options
  logLevelOptions = enum ["error" "warn" "in
fo" "debug" "trace"];

  # Anti-conceal ignore options submodule
  antiConcealIgnoreOptions = submodule {
    options = {
      head_icon = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where head icon
 anti-conceal behavior will be ignored";
      };
      head_background = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where head back
ground anti-conceal behavior will be ignored
";
      };
      head_border = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where head bord
er anti-conceal behavior will be ignored";
      };
      code_language = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where code lang
uage anti-conceal behavior will be ignored";
      };
      code_background = mkOption {
        type = nullOr bool;
        default = true;
        description = "Whether to ignore cod
e background anti-conceal behavior";
      };
      code_border = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where code bord
er anti-conceal behavior will be ignored";
      };
      dash = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where dash anti
-conceal behavior will be ignored";
      };
      bullet = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where bullet an
ti-conceal behavior will be ignored";
      };
      check_icon = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where check ico
n anti-conceal behavior will be ignored";
      };
      check_scope = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where check sco
pe anti-conceal behavior will be ignored";
      };
      quote = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where quote ant
i-conceal behavior will be ignored";
      };
      table_border = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where table bor
der anti-conceal behavior will be ignored";
      };
      callout = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where callout a
nti-conceal behavior will be ignored";
      };
      link = mkOption {
        type = nullOr (listOf (enum neovimMo
des));
        default = null;
        description = "Modes where link anti
-conceal behavior will be ignored";
      };
      sign = mkOption {
        type = nullOr bool;
        default = true;
        description = "Whether to ignore sig
n anti-conceal behavior";
      };
    };
  };

  # Injection options submodule
  injectionOptions = submodule {
    options = {
      enabled = mkOption {
        type = nullOr bool;
        default = null;
        description = "Whether this injectio
n is enabled";
      };
      query = mkOption {
        type = luaInline;
        description = "Treesitter query for 
the injection";
      };
    };
  };

  headingWidthType = enum ["block" "full"];

  headingPositionType = enum ["right" "inlin
e" "overlay"];
in {
  options.vim.notes.render-markdown-nvim = {
    enable = mkEnableOption "Inline markdown
 rendering";
    setupOpts = mkPluginSetupOption "render-
markdown" {
      enabled = mkOption {
        type = bool;
        default = true;
        description = "Whether Markdown shou
ld be rendered by default";
      };

      render_modes = mkOption {
        type = listOf (enum neovimModes);
        default = ["n" "c" "t"];
        description = ''
          Vim modes that will show a rendere
d view of the markdown file.
          Individual components can be enabl
ed for other modes.
        '';
      };

      max_file_size = mkOption {
        type = float;
        default = 10.0;
        description = "Maximum file size (in
 MB) that this plugin will attempt to render
";
      };

      debounce = mkOption {
        type = int;
        default = 100;
        description = "Milliseconds that mus
t pass before updating marks";
      };

      preset = mkOption {
        type = presetOptions;
        default = "none";
        description = "Pre-configured settin
gs to mimic various target user experiences"
;
      };

      log_level = mkOption {
        type = logLevelOptions;
        default = "error";
        description = "The level of logs to 
write to file";
      };

      log_runtime = mkOption {
        type = bool;
        default = false;
        description = "Print runtime of main
 update method";
      };

      file_types = mkOption {
        type = listOf str;
        default = ["markdown"];
        description = "Filetypes this plugin
 will run on";
      };

      injections = mkOption {
        type = attrsOf injectionOptions;
        default = {
          gitcommit = {
            enabled = true;
            query = ''
              ((message) @injection.content
                  (#set! injection.combined)
                  (#set! injection.include-c
hildren)
                  (#set! injection.language 
"markdown"))
            '';
          };
        };
        description = "Language injections f
or known filetypes";
      };

      anti_conceal = {
        enabled = mkOption {
          type = bool;
          default = true;
          description = "Enable hiding added
 text on the cursor line";
        };

        ignore = mkOption {
          type = antiConcealIgnoreOptions;
          default = {
            code_background = true;
            sign = true;
          };
          description = "Elements to always 
show, ignoring anti-conceal behavior";
        };

        above = mkOption {
          type = int;
          default = 0;
          description = "Number of lines abo
ve cursor to show";
        };

        below = mkOption {
          type = int;
          default = 0;
          description = "Number of lines bel
ow cursor to show";
        };
      };

      padding = {
        highlight = mkOption {
          type = str;
          default = "Normal";
          description = "Highlight to use wh
en adding whitespace";
        };
      };

      on = {
        attach = mkOption {
          type = nullOr luaInline;
          default = null;
          description = "Called when plugin 
initially attaches to a buffer";
        };

        render = mkOption {
          type = nullOr luaInline;
          default = null;
          description = "Called after plugin
 renders a buffer";
        };
      };

      latex = {
        enabled = mkOption {
          type = nullOr bool;
          default = null;
          description = "Whether LaTeX shoul
d be rendered";
        };

        render_modes = mkOption {
          type = nullOr bool;
          default = null;
          description = "Additional modes to
 render LaTeX";
        };

        converter = mkOption {
          type = nullOr str;
          default = null;
          description = "Executable used to 
convert latex formula to rendered unicode";
        };

        highlight = mkOption {
          type = nullOr str;
          default = null;
          description = "Highlight for LaTeX
 blocks";
        };

        top_pad = mkOption {
          type = nullOr int;
          default = null;
          description = "Amount of empty lin
es above LaTeX blocks";
        };

        bottom_pad = mkOption {
          type = nullOr int;
          default = null;
          description = "Amount of empty lin
es below LaTeX blocks";
        };
      };

      heading = {
        enabled = mkOption {
          type = nullOr bool;
          default = null;
          description = "Enable heading icon
 & background rendering";
        };

        render_modes = mkOption {
          type = nullOr bool;
          default = null;
          description = "Additional modes to
 render headings";
        };

        sign = mkOption {
          type = nullOr bool;
          default = null;
          description = "Turn on/off sign co
lumn related rendering";
        };

        icons = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Icons for different
 heading levels";
        };

        position = mkOption {
          type = nullOr headingPositionType;
          default = null;
          description = "How icons fill avai
lable space";
        };

        signs = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Signs added to the 
sign column if enabled";
        };

        width = mkOption {
          type = nullOr (either headingWidth
Type (listOf headingWidthType));
          default = null;
          description = "Width of the headin
g background";
        };

        left_margin = mkOption {
          type = nullOr (either float (listO
f float));
          default = null;
          description = "Margin to add to le
ft of headings";
        };

        left_pad = mkOption {
          type = nullOr (either float (listO
f float));
          default = null;
          description = "Padding to add to l
eft of headings";
        };

        right_pad = mkOption {
          type = nullOr (either float (listO
f float));
          default = null;
          description = "Padding to add to r
ight of headings when width is 'block'";
        };

        min_width = mkOption {
          type = nullOr (either int (listOf 
int));
          default = null;
          description = "Minimum width for h
eadings when width is 'block'";
        };

        border = mkOption {
          type = nullOr (either bool (listOf
 bool));
          default = null;
          description = "Add border above an
d below headings";
        };

        border_virtual = mkOption {
          type = nullOr bool;
          default = null;
          description = "Always use virtual 
lines for heading borders";
        };

        border_prefix = mkOption {
          type = nullOr bool;
          default = null;
          description = "Highlight border st
art using foreground highlight";
        };

        above = mkOption {
          type = nullOr str;
          default = null;
          description = "Character used abov
e heading for border";
        };

        below = mkOption {
          type = nullOr str;
          default = null;
          description = "Character used belo
w heading for border";
        };

        backgrounds = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Highlights for head
ing backgrounds per level";
        };

        foregrounds = mkOption {
          type = nullOr (listOf str);
          default = null;
          description = "Highlights for head
ing and sign icons per level";
        };
      };
    };
  };
}
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET