CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 63
Markdown
Tip
You can find the type definition in definitions/renderers/markdown.lua.
Options that change how different elements are shown in the preview. You can find the default value here.
---@type markview.config.markdown
markdown = {
enable = true,
block_quotes = {
enable = true,
wrap = true,
default = {
border = "▋",
hl = "MarkviewBlockQuoteDefault"
},
["ABSTRACT"] = {
preview = " Abstract",
hl = "MarkviewBlockQuoteNote",
title = true,
icon = "",
},
["SUMMARY"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Summary",
title = true,
icon = "",
},
["TLDR"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Tldr",
title = true,
icon = "",
},
["TODO"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Todo",
title = true,
icon = "",
},
["INFO"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Info",
custom_title = true,
icon = "",
},
["SUCCESS"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Success",
title = true,
icon = "",
},
["CHECK"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Check",
title = true,
icon = "",
},
["DONE"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Done",
title = true,
icon = "",
},
["QUESTION"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Question",
title = true,
icon = "",
},
["HELP"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Help",
title = true,
icon = "",
},
["FAQ"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Faq",
title = true,
icon = "",
},
["FAILURE"] = {
hl = "MarkviewBlockQuoteError",
preview = " Failure",
title = true,
icon = "",
},
["FAIL"] = {
hl = "MarkviewBlockQuoteError",
preview = " Fail",
title = true,
icon = "",
},
["MISSING"] = {
hl = "MarkviewBlockQuoteError",
preview = " Missing",
title = true,
icon = "",
},
["DANGER"] = {
hl = "MarkviewBlockQuoteError",
preview = " Danger",
title = true,
icon = "",
},
["ERROR"] = {
hl = "MarkviewBlockQuoteError",
preview = " Error",
title = true,
icon = "",
},
["BUG"] = {
hl = "MarkviewBlockQuoteError",
preview = " Bug",
title = true,
icon = "",
},
["EXAMPLE"] = {
hl = "MarkviewBlockQuoteSpecial",
preview = " Example",
title = true,
icon = "",
},
["QUOTE"] = {
hl = "MarkviewBlockQuoteDefault",
preview = " Quote",
title = true,
icon = "",
},
["CITE"] = {
hl = "MarkviewBlockQuoteDefault",
preview = " Cite",
title = true,
icon = "",
},
["HINT"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Hint",
title = true,
icon = "",
},
["ATTENTION"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Attention",
title = true,
icon = "",
},
["NOTE"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Note",
title = true,
icon = "",
},
["TIP"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Tip",
title = true,
icon = "",
},
["IMPORTANT"] = {
hl = "MarkviewBlockQuoteSpecial",
preview = " Important",
title = true,
icon = "",
},
["WARNING"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Warning",
title = true,
icon = "",
},
["CAUTION"] = {
hl = "MarkviewBlockQuoteError",
preview = " Caution",
title = true,
icon = "",
}
},
code_blocks = {
enable = true,
style = "block",
label_direction = "right",
border_hl = "MarkviewCode",
info_hl = "MarkviewCodeInfo",
min_width = 60,
pad_amount = 2,
pad_char = " ",
sign = true,
default = {
block_hl = "MarkviewCode",
pad_hl = "MarkviewCode"
},
["diff"] = {
block_hl = function (_, line)
if line:match("^%+") then
return "MarkviewPalette4";
elseif line:match("^%-") then
return "MarkviewPalette1";
else
return "MarkviewCode";
end
end,
pad_hl = "MarkviewCode"
}
},
headings = {
enable = true,
heading_1 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading1Sign",
icon = " ", hl = "MarkviewHeading1",
},
heading_2 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading2Sign",
icon = " ", hl = "MarkviewHeading2",
},
heading_3 = {
style = "icon",
icon = " ", hl = "MarkviewHeading3",
},
heading_4 = {
style = "icon",
icon = " ", hl = "MarkviewHeading4",
},
heading_5 = {
style = "icon",
icon = " ", hl = "MarkviewHeading5",
},
heading_6 = {
style = "icon",
icon = " ", hl = "MarkviewHeading6",
},
setext_1 = {
style = "decorated",
sign = " ", sign_hl = "MarkviewHeading1Sign",
icon = " ", hl = "MarkviewHeading1",
border = "▂"
},
setext_2 = {
style = "decorated",
sign = " ", sign_hl = "MarkviewHeading2Sign",
icon = " ", hl = "MarkviewHeading2",
border = "▁"
},
shift_width = 1,
org_indent = false,
org_indent_wrap = true,
org_shift_char = " ",
org_shift_width = 1,
},
horizontal_rules = {
enable = true,
parts = {
{
type = "repeating",
direction = "left",
repeat_amount = function (buffer)
local utils = require("markview.utils");
local window = utils.buf_getwin(buffer)
local width = vim.api.nvim_win_get_width(window)
local textoff = vim.fn.getwininfo(window)[1].textoff;
return math.floor((width - textoff - 3) / 2);
end,
text = "─",
hl = {
"MarkviewGradient1", "MarkviewGradient1",
"MarkviewGradient2", "MarkviewGradient2",
"MarkviewGradient3", "MarkviewGradient3",
"MarkviewGradient4", "MarkviewGradient4",
"MarkviewGradient5", "MarkviewGradient5",
"MarkviewGradient6", "MarkviewGradient6",
"MarkviewGradient7", "MarkviewGradient7",
"MarkviewGradient8", "MarkviewGradient8",
"MarkviewGradient9", "MarkviewGradient9"
}
},
{
type = "text",
text = " ",
hl = "MarkviewIcon3Fg"
},
{
type = "repeating",
direction = "right",
repeat_amount = function (buffer) --[[@as function]]
local utils = require("markview.utils");
local window = utils.buf_getwin(buffer)
local width = vim.api.nvim_win_get_width(window)
local textoff = vim.fn.getwininfo(window)[1].textoff;
return math.ceil((width - textoff - 3) / 2);
end,
text = "─",
hl = {
"MarkviewGradient1", "MarkviewGradient1",
"MarkviewGradient2", "MarkviewGradient2",
"MarkviewGradient3", "MarkviewGradient3",
"MarkviewGradient4", "MarkviewGradient4",
"MarkviewGradient5", "MarkviewGradient5",
"MarkviewGradient6", "MarkviewGradient6",
"MarkviewGradient7", "MarkviewGradient7",
"MarkviewGradient8", "MarkviewGradient8",
"MarkviewGradient9", "MarkviewGradient9"
}
}
}
},
list_items = {
enable = true,
wrap = true,
indent_size = function (buffer)
if type(buffer) ~= "number" then
return vim.bo.shiftwidth or 4;
end
--- Use 'shiftwidth' value.
return vim.bo[buffer].shiftwidth or 4;
end,
shift_width = 4,
marker_minus = {
add_padding = true,
conceal_on_checkboxes = true,
text = "●",
hl = "MarkviewListItemMinus"
},
marker_plus = {
add_padding = true,
conceal_on_checkboxes = true,
text = "◈",
hl = "MarkviewListItemPlus"
},
marker_star = {
add_padding = true,
conceal_on_checkboxes = true,
text = "◇",
hl = "MarkviewListItemStar"
},
marker_dot = {
add_padding = true,
conceal_on_checkboxes = true
},
marker_parenthesis = {
add_padding = true,
conceal_on_checkboxes = true
}
},
metadata_minus = {
enable = true,
hl = "MarkviewCode",
border_hl = "MarkviewCodeFg",
border_top = "▄",
border_bottom = "▀"
},
metadata_plus = {
enable = true,
hl = "MarkviewCode",
border_hl = "MarkviewCodeFg",
border_top = "▄",
border_bottom = "▀"
},
reference_definitions = {
enable = true,
default = {
icon = " ",
hl = "MarkviewPalette4Fg"
},
["github%.com/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/tree/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/tree/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/commits/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/commits/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/releases$"] = {
--- github.com/<user>/<repo>/releases
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/tags$"] = {
--- github.com/<user>/<repo>/tags
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/issues$"] = {
--- github.com/<user>/<repo>/issues
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/pulls$"] = {
--- github.com/<user>/<repo>/pulls
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/wiki$"] = {
--- github.com/<user>/<repo>/wiki
icon = " ",
hl = "MarkviewPalette0Fg"
},
["developer%.mozilla%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["w3schools%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette4Fg"
},
["stackoverflow%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["reddit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["github%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["gitlab%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["dev%.to"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["codepen%.io"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["replit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["jsfiddle%.net"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["npmjs%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["pypi%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["mvnrepository%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette1Fg"
},
["medium%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["linkedin%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["news%.ycombinator%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
},
tables = {
enable = true,
strict = false,
col_min_width = 10,
block_decorator = true,
use_virt_lines = false,
parts = {
top = { "╭", "─", "╮", "┬" },
header = { "│", "│", "│" },
separator = { "├", "─", "┤", "┼" },
row = { "│", "│", "│" },
bottom = { "╰", "─", "╯", "┴" },
overlap = { "┝", "━", "┥", "┿" },
align_left = "╼",
align_right = "╾",
align_center = { "╴", "╶" }
},
hl = {
top = { "TableHeader", "TableHeader", "TableHeader", "TableHeader" },
header = { "TableHeader", "TableHeader", "TableHeader" },
separator = { "TableHeader", "TableHeader", "TableHeader", "TableHeader" },
row = { "TableBorder", "TableBorder", "TableBorder" },
bottom = { "TableBorder", "TableBorder", "TableBorder", "TableBorder" },
overlap = { "TableBorder", "TableBorder", "TableBorder", "TableBorder" },
align_left = "TableAlignLeft",
align_right = "TableAlignRight",
align_center = { "TableAlignCenter", "TableAlignCenter" }
}
},
},
- type:
boolean
default:true
Enables previewing of markdown.
Changes how block quotes look. Each key in the table(other then enable
, wrap
& default
) represents a new callout type.
When matching a callout to it's configuration the key is matched case insensitively, meaning ["NOTE"] = {}
in the config will match >[!NOTE]
, >[!Note]
, >[!NoTe]
& any other variations of this text.
---@type markview.config.markdown.block_quotes
block_quotes = {
enable = true,
wrap = true,
default = {
border = "▋",
hl = "MarkviewBlockQuoteDefault"
},
["ABSTRACT"] = {
preview = " Abstract",
hl = "MarkviewBlockQuoteNote",
title = true,
icon = "",
},
["SUMMARY"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Summary",
title = true,
icon = "",
},
["TLDR"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Tldr",
title = true,
icon = "",
},
["TODO"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Todo",
title = true,
icon = "",
},
["INFO"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Info",
custom_title = true,
icon = "",
},
["SUCCESS"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Success",
title = true,
icon = "",
},
["CHECK"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Check",
title = true,
icon = "",
},
["DONE"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Done",
title = true,
icon = "",
},
["QUESTION"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Question",
title = true,
icon = "",
},
["HELP"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Help",
title = true,
icon = "",
},
["FAQ"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Faq",
title = true,
icon = "",
},
["FAILURE"] = {
hl = "MarkviewBlockQuoteError",
preview = " Failure",
title = true,
icon = "",
},
["FAIL"] = {
hl = "MarkviewBlockQuoteError",
preview = " Fail",
title = true,
icon = "",
},
["MISSING"] = {
hl = "MarkviewBlockQuoteError",
preview = " Missing",
title = true,
icon = "",
},
["DANGER"] = {
hl = "MarkviewBlockQuoteError",
preview = " Danger",
title = true,
icon = "",
},
["ERROR"] = {
hl = "MarkviewBlockQuoteError",
preview = " Error",
title = true,
icon = "",
},
["BUG"] = {
hl = "MarkviewBlockQuoteError",
preview = " Bug",
title = true,
icon = "",
},
["EXAMPLE"] = {
hl = "MarkviewBlockQuoteSpecial",
preview = " Example",
title = true,
icon = "",
},
["QUOTE"] = {
hl = "MarkviewBlockQuoteDefault",
preview = " Quote",
title = true,
icon = "",
},
["CITE"] = {
hl = "MarkviewBlockQuoteDefault",
preview = " Cite",
title = true,
icon = "",
},
["HINT"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Hint",
title = true,
icon = "",
},
["ATTENTION"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Attention",
title = true,
icon = "",
},
["NOTE"] = {
hl = "MarkviewBlockQuoteNote",
preview = " Note",
title = true,
icon = "",
},
["TIP"] = {
hl = "MarkviewBlockQuoteOk",
preview = " Tip",
title = true,
icon = "",
},
["IMPORTANT"] = {
hl = "MarkviewBlockQuoteSpecial",
preview = " Important",
title = true,
icon = "",
},
["WARNING"] = {
hl = "MarkviewBlockQuoteWarn",
preview = " Warning",
title = true,
icon = "",
},
["CAUTION"] = {
hl = "MarkviewBlockQuoteError",
preview = " Caution",
title = true,
icon = "",
}
}
- type:
boolean
default:true
Self-explanatory.
- type:
boolean
default:true
Enables wrap
support, which causes block quote's border to appear where the text gets wrapped.
Caution
Detecting where to show the border is done manually, sometimes it may be incorrect(e.g. after resizing the Terminal).
Configuration for regular block quotes.
---@type markview.config.markdown.block_quotes.opts
default = {
border = nil,
hl = nil
}
- type:
string
default:"▋"
Text used for the border.
- type:
string
default:"MarkviewBlockQuoteDefault"
Highlight group for the border.
Configuration for >[!string]
callout.
["TEST"] = {
border = nil,
border_hl = nil,
hl = nil,
icon = nil,
icon_hl = nil,
preview = nil,
preview_hl = nil,
title = true,
},
- type:
string
Text used for the border.
- type:
string
Highlight group for the border.
- type:
string
Highlight group for this callout. border_hl, icon_hl & preview_hl use this value when they are unset.
- type:
string
Text used as an icon.
Note
This only works if title is set to true
.
- type:
string
Highlight group for icon.
- type:
string
Text shown instead of >[!...]
.
- type:
string
Highlight group for preview.
- type:
boolean
Enables Obsidian-style titles in callouts.
Note
Titles have the following structure >[!<callout>] <title>
See also,
- icon_provider, for disabling icons.
Changes how fenced code blocks look.
code_blocks = {
enable = true,
border_hl = "MarkviewCode",
info_hl = "MarkviewCodeInfo",
label_direction = "right",
label_hl = nil,
min_width = 60,
pad_amount = 2,
pad_char = " ",
default = {
block_hl = "MarkviewCode",
pad_hl = "MarkviewCode"
},
["diff"] = {
block_hl = function (_, line)
if line:match("^%+") then
return "MarkviewPalette4";
elseif line:match("^%-") then
return "MarkviewPalette1";
else
return "MarkviewCode";
end
end,
pad_hl = "MarkviewCode"
},
style = "block",
sign = true,
},
- type:
boolean
default:true
Self-explanatory.
- type:
string
default:"MarkviewCode"
Highlight group used for the top & bottom part of the code block.
- type:
string
default:"MarkviewCodeInfo"
Highlight group used for the info string.
- type:
"left" | "right"
default:"right"
Which side the language name & icon should be shown on.
- type:
string
Highlight group used for the language name & icon.
Tip
This can be used to overwrite the highlight group set by the icon_provider!
- type:
integer
default:60
Minimum width of code blocks.
- type:
integer
default:2
Width of the left & right border/padding.
- type:
string
default:" "
Character used for the borders/paddings.
Default configuration for highlighting a line of the code block.
---@type markview.config.markdown.code_blocks.opts
default = {
block_hl = "MarkviewCode",
pad_hl = "MarkviewCode"
},
- type:
string
default:"MarkviewCode"
Highlight group for the text of a line.
- type:
string
default:"MarkviewCode"
Highlight group for the padding around the line.
Configuration for code blocks whose language is string
.
---@type markview.config.markdown.code_blocks.opts
["string"] = {
block_hl = nil,
pad_hl = nil
},
Tip
You can use this for making stuff like diff
prettier!
- type:
string | fun(bufnr: integer, line: string): string
Highlight group for the text of a line.
- type:
string | fun(bufnr: integer, line: string): string
Highlight group for the padding around the line.
- type:
"simple" | "block"
default:"block"
Changes how code blocks are shown. Supported values are,
-
"simple"
Entire line is highlighted. Useful whenwrap
is enabled. -
"block"
A block is created around the code block and paddings are added before & after each line.
- type:
boolean
default:true
Enables language icon in the signcolumn.
Changes how ATX & Setext headings are shown.
---@type markview.config.markdown.headings
headings = {
enable = true,
heading_1 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading1Sign",
icon = " ", hl = "MarkviewHeading1",
},
heading_2 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading2Sign",
icon = " ", hl = "MarkviewHeading2",
},
heading_3 = {
style = "icon",
icon = " ", hl = "MarkviewHeading3",
},
heading_4 = {
style = "icon",
icon = " ", hl = "MarkviewHeading4",
},
heading_5 = {
style = "icon",
icon = " ", hl = "MarkviewHeading5",
},
heading_6 = {
style = "icon",
icon = " ", hl = "MarkviewHeading6",
},
setext_1 = {
style = "decorated",
sign = " ", sign_hl = "MarkviewHeading1Sign",
icon = " ", hl = "MarkviewHeading1",
border = "▂"
},
setext_2 = {
style = "decorated",
sign = " ", sign_hl = "MarkviewHeading2Sign",
icon = " ", hl = "MarkviewHeading2",
border = "▁"
},
shift_width = 1,
org_indent = false,
org_indent_wrap = true,
org_shift_char = " ",
org_shift_width = 1,
},
- type:
boolean
default:true
Self-explanatory.
Changes how level 1 ATX headings are shown.
---@type markview.config.markdown.headings.atx
heading_1 = {
align = nil,
corner_left = nil,
corner_left_hl = nil,
corner_right = nil,
corner_right_hl = nil,
hl = nil,
icon = nil,
icon_hl = nil,
padding_left = nil,
padding_left_hl = nil,
padding_right = nil,
padding_right_hl = nil,
sign = nil,
sign_hl = nil,
style = nil,
},
Important
This only has effect if style is set to label
.
- type:
"left" | "center" | "right"
Allows pinning the heading text to a specific side of the window. Useful if a buffer is being viewed by a single window.
Important
This only has effect if style is set to label
.
- type:
string
Text used as the left corner of the label.
Important
This only has effect if style is set to label
.
- type:
tring"
Highlight group for corner_left.
Important
This only has effect if style is set to label
.
- type:
string
Text used as the right corner of the label.
Important
This only has effect if style is set to label
.
- type:
tring"
Highlight group for corner_right.
- type:
string
Highlight group for heading_1.
This will be used by corner_left_hl, corner_right_hl, padding_left_hl, padding_right_hl, icon_hl & sign_hl.
Important
This option isn't used if style is set to simple
.
- type:
string
Text used for icon(added after padding_left when style is label
).
Important
This option isn't used if style is set to simple
.
- type:
string
Highlight group for icon.
Important
This only has effect if style is set to label
.
- type:
string
Text used as the left padding of the label.
Important
This only has effect if style is set to label
.
- type:
tring"
Highlight group for padding_left.
Important
This only has effect if style is set to label
.
- type:
string
Text used as the right padding of the label.
Important
This only has effect if style is set to label
.
- type:
tring"
Highlight group for padding_right.
- type:
string
Text to show in the signcolumn.
- type:
tring"
Highlight group for sign.
- type:
"simple" | "label" | "icon"
Heading style. Possible values are,
-
"simple"
The heading line is highlighted. -
"label"
Glow-like headings, supports corners, paddings & icon. -
"icon"
Only shows the icon.
Changes how level 2 ATX headings are shown. Options are same as heading_1.
Changes how level 3 ATX headings are shown. Options are same as heading_1.
Changes how level 4 ATX headings are shown. Options are same as heading_1.
Changes how level 5 ATX headings are shown. Options are same as heading_1.
Changes how level 6 ATX headings are shown. Options are same as heading_1.
Changes how level 1 Setext headings are shown.
---@type markview.config.markdown.headings.setext
setext_1 = {
border = nil,
border_hl = nil,
hl = nil,
icon = nil,
icon_hl = nil,
sign = nil,
sign_hl = nil,
style = nil,
}
- type:
string
Text to create the border below the text of the heading.
- type:
string
Highlight group for border.
- type:
string
Highlight group for Setext headings. Used by border_hl, icon_hl & sign_hl when not set.
- type:
string
Text to show in the signcolumn.
- type:
string
Highlight group for sign.
- type:
"simple" | "decorated"
Heading style. Possible values are,
-
"simple"
The heading line is highlighted. -
"decorated"
A line is draw under the text and an icon is shown before the text.
Changes how level 2 Setext headings are shown. Options are same as setext_1.
- type:
integer
default:1
Number of spaces to add per heading level.
- type:
boolean
default:false
Enables Org-like indenting sections of the document based on the heading.
Note
This has no effect if org_indent isn't enabled.
- type:
boolean
default:false
Enables wrap support for org_indent.
- type:
string
default:" "
Text used for indenting in org_indent.
- type:
integer
default:1
Number of characters to add per heading level in org_indent.
Changes how line breaks look.
---@type markview.config.markdown.horizontal_rules
horizontal_rules = {
enable = true,
parts = {
{
type = "repeating",
direction = "left",
repeat_amount = function (buffer)
local utils = require("markview.utils");
local window = utils.buf_getwin(buffer)
local width = vim.api.nvim_win_get_width(window)
local textoff = vim.fn.getwininfo(window)[1].textoff;
return math.floor((width - textoff - 3) / 2);
end,
text = "─",
hl = {
"MarkviewGradient1", "MarkviewGradient1",
"MarkviewGradient2", "MarkviewGradient2",
"MarkviewGradient3", "MarkviewGradient3",
"MarkviewGradient4", "MarkviewGradient4",
"MarkviewGradient5", "MarkviewGradient5",
"MarkviewGradient6", "MarkviewGradient6",
"MarkviewGradient7", "MarkviewGradient7",
"MarkviewGradient8", "MarkviewGradient8",
"MarkviewGradient9", "MarkviewGradient9"
}
},
{
type = "text",
text = " ",
hl = "MarkviewIcon3Fg"
},
{
type = "repeating",
direction = "right",
repeat_amount = function (buffer) --[[@as function]]
local utils = require("markview.utils");
local window = utils.buf_getwin(buffer)
local width = vim.api.nvim_win_get_width(window)
local textoff = vim.fn.getwininfo(window)[1].textoff;
return math.ceil((width - textoff - 3) / 2);
end,
text = "─",
hl = {
"MarkviewGradient1", "MarkviewGradient1",
"MarkviewGradient2", "MarkviewGradient2",
"MarkviewGradient3", "MarkviewGradient3",
"MarkviewGradient4", "MarkviewGradient4",
"MarkviewGradient5", "MarkviewGradient5",
"MarkviewGradient6", "MarkviewGradient6",
"MarkviewGradient7", "MarkviewGradient7",
"MarkviewGradient8", "MarkviewGradient8",
"MarkviewGradient9", "MarkviewGradient9"
}
}
}
},
- type:
boolean
default:true
Self-explanatory.
Parts to create the line.
Shows some text literally.
---@type markview.config.markdown.hr.text
{
type = "text",
text = nil,
hl = nil
}
- type:
string
Text to show.
- type:
string
Highlight group for text.
Repeats the given text by the given amount.
---@type markview.config.markdown.hr.repeating
{
type = "repeating",
direction = nil,
repeat_amount = nil,
text = nil,
hl = nil,
}
- type:
"left" | "right"
Repeat direction.
- type:
integer
Amount of time to repeat.
- type:
string[] | string
Text to repeat.
- type:
string[] | string
Highlight group for text.
Changes how list items are shown.
---@type markview.config.markdown.list_items
list_items = {
enable = true,
wrap = true,
indent_size = function (buffer)
if type(buffer) ~= "number" then
return vim.bo.shiftwidth or 4;
end
--- Use 'shiftwidth' value.
return vim.bo[buffer].shiftwidth or 4;
end,
shift_width = 4,
marker_minus = {
add_padding = true,
conceal_on_checkboxes = true,
text = "●",
hl = "MarkviewListItemMinus"
},
marker_plus = {
add_padding = true,
conceal_on_checkboxes = true,
text = "◈",
hl = "MarkviewListItemPlus"
},
marker_star = {
add_padding = true,
conceal_on_checkboxes = true,
text = "◇",
hl = "MarkviewListItemStar"
},
marker_dot = {
add_padding = true,
conceal_on_checkboxes = true
},
marker_parenthesis = {
add_padding = true,
conceal_on_checkboxes = true
}
},
- type:
boolean
default:true
Self-explanatory.
- type:
boolean
default:true
Enables wrap
support, which causes indentation to appear where the text gets wrapped.
Caution
Detecting where to add the indentation is done manually, sometimes it may be incorrect(e.g. after resizing the Terminal).
- type:
integer | fun(bufnr: integer): integer
Indentation size in list items.
Important
Using tabs for indentation can cause incorrect indent to show up!
- type:
integer | fun(bufnr: integer): integer
default:4
Number of spaces to add per indent level of a list item.
Configuration for N.
list items.
---@type markview.config.markdown.list_items.ordered
marker_dot = {
enable = true,
add_padding = true,
conceal_on_checkboxes = true
}
- type:
boolean
default:true
Self-explanatory.
- type:
boolean
default:true
Enables indentation in preview for this type of list items.
- type:
boolean
default:true
Allows hiding the marker of the list item when checkboxes are present.
Configuration for -
list items.
---@type markview.config.markdown.list_items.unordered
marker_minus = {
enable = true,
add_padding = true,
conceal_on_checkboxes = true,
text = "●",
hl = "MarkviewListItemMinus"
}
- type:
boolean
default:true
Self-explanatory.
- type:
boolean
default:true
Enables indentation in preview for this type of list items.
- type:
boolean
default:true
Allows hiding the marker of the list item when checkboxes are present.
- type:
string
default:"●"
Text used as the marker in preview.
- type:
string
default:"MarkviewListItemMinus"
Highlight group for text.
Configuration for N)
list items. Same as marker_dot.
Configuration for +
list items. Same as marker_minus.
Configuration for *
list items. Same as marker_minus.
Changes how YAML metadata block is shown.
---@type markview.config.markdown.metadata
metadata_minus = {
enable = true,
hl = "MarkviewCode",
border_hl = "MarkviewCodeFg",
border_top = "▄",
border_bottom = "▀"
},
- type:
boolean
default:true
Self-explanatory.
- type:
string
default:"▀"
Border shown below the YAML block.
- type:
string
Highlight group for border_bottom.
- type:
string
default:"▄"
Border shown above the YAML block.
- type:
string
Highlight group for border_top.
- type:
string
default:"MarkviewCodeFg"
Highlight group for the borders. Used by border_top & border_bottom when not set.
- type:
string
default:"MarkviewCode"
Highlight group for the background.
Changes how TOML metadata block is shown. Same as metadata_minus.
Changes how reference definitions are shown.
---@type markview.config.markdown.ref_def
reference_definitions = {
enable = true,
default = {
icon = " ",
hl = "MarkviewPalette4Fg"
},
["github%.com/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/tree/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/tree/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/commits/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/commits/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/releases$"] = {
--- github.com/<user>/<repo>/releases
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/tags$"] = {
--- github.com/<user>/<repo>/tags
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/issues$"] = {
--- github.com/<user>/<repo>/issues
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/pulls$"] = {
--- github.com/<user>/<repo>/pulls
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/wiki$"] = {
--- github.com/<user>/<repo>/wiki
icon = " ",
hl = "MarkviewPalette0Fg"
},
["developer%.mozilla%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["w3schools%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette4Fg"
},
["stackoverflow%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["reddit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["github%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["gitlab%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["dev%.to"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["codepen%.io"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["replit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["jsfiddle%.net"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["npmjs%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["pypi%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["mvnrepository%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette1Fg"
},
["medium%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["linkedin%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["news%.ycombinator%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
},
- type:
boolean
default:true
Self-explanatory.
Default configuration. See how inline elements are configured.
- type: markview.config.__inline
Configuration for reference link definitions whose destination matches string
. See how inline elements are configured.
Note
The structure for reference links is [label]: <destination>
.
Changes how tables are shown.
---@type markview.config.markdown.tables
tables = {
enable = true,
strict = false,
block_decorator = true,
use_virt_lines = false,
parts = {
top = { "╭", "─", "╮", "┬" },
header = { "│", "│", "│" },
separator = { "├", "─", "┤", "┼" },
row = { "│", "│", "│" },
bottom = { "╰", "─", "╯", "┴" },
overlap = { "┝", "━", "┥", "┿" },
align_left = "╼",
align_right = "╾",
align_center = { "╴", "╶" }
},
hl = {
top = { "TableHeader", "TableHeader", "TableHeader", "TableHeader" },
header = { "TableHeader", "TableHeader", "TableHeader" },
separator = { "TableHeader", "TableHeader", "TableHeader", "TableHeader" },
row = { "TableBorder", "TableBorder", "TableBorder" },
bottom = { "TableBorder", "TableBorder", "TableBorder", "TableBorder" },
overlap = { "TableBorder", "TableBorder", "TableBorder", "TableBorder" },
align_left = "TableAlignLeft",
align_right = "TableAlignRight",
align_center = { "TableAlignCenter", "TableAlignCenter" }
}
},
- type:
boolean
default:true
Self-explanatory.
- type:
boolean
default:false
When enabled, leading & trailing whitespaces won't be considered part of table cell.
- type:
boolean
default:true
Allows rendering top & bottom border of tables.
- type:
boolean
default:false
Allows rendering block_decorator as virtual lines.
Parts used to create the preview.
- type:
string[]
List containing 4 parts defining the top border. These parts are used for,
- Left corner
- Top
- Right corner
- Column separator
- type:
string[]
List containing 3 parts defining the header's border. These parts are used for,
- Left border
- Column separator
- Right border
- type:
string[]
List containing 4 parts defining the header & row separator. These parts are used for,
- Leftmost border
- Horizontal border
- Rightmost corner
- Column separator
- type:
string[]
List containing 3 parts defining the row's border. It has the same structure as header
- type:
string[]
List containing 4 parts defining the bottom border. It has the same structure as top.
Highlight group for various parts. It has the same structure as parts.