--- /dev/null
+require('render-markdown').setup({
+ heading = {
+ -- Useful context to have when evaluating values.
+ -- | level | the number of '#' in the heading marker |
+ -- | sections | for each level how deeply nested the heading is |
+
+ -- Turn on / off heading icon & background rendering.
+ enabled = true,
+ -- Additional modes to render headings.
+ render_modes = false,
+ -- Turn on / off atx heading rendering.
+ atx = true,
+ -- Turn on / off setext heading rendering.
+ setext = true,
+ -- Turn on / off sign column related rendering.
+ sign = true,
+ -- Replaces '#+' of 'atx_h._marker'.
+ -- Output is evaluated depending on the type.
+ -- | function | `value(context)` |
+ -- | string[] | `cycle(value, context.level)` |
+ icons = { '1 ', '2 ', '3 ', '4 ', '5 ', '6 ' },
+ -- Determines how icons fill the available space.
+ -- | right | '#'s are concealed and icon is appended to right side |
+ -- | inline | '#'s are concealed and icon is inlined on left side |
+ -- | overlay | icon is left padded with spaces and inserted on left hiding additional '#' |
+ position = 'overlay',
+ -- Added to the sign column if enabled.
+ -- Output is evaluated by `cycle(value, context.level)`.
+ signs = { '' },
+ -- Width of the heading background.
+ -- | block | width of the heading text |
+ -- | full | full width of the window |
+ -- Can also be a list of the above values evaluated by `clamp(value, context.level)`.
+ width = 'full',
+ -- Amount of margin to add to the left of headings.
+ -- Margin available space is computed after accounting for padding.
+ -- If a float < 1 is provided it is treated as a percentage of available window space.
+ -- Can also be a list of numbers evaluated by `clamp(value, context.level)`.
+ left_margin = 0,
+ -- Amount of padding to add to the left of headings.
+ -- Output is evaluated using the same logic as 'left_margin'.
+ left_pad = 0,
+ -- Amount of padding to add to the right of headings when width is 'block'.
+ -- Output is evaluated using the same logic as 'left_margin'.
+ right_pad = 0,
+ -- Minimum width to use for headings when width is 'block'.
+ -- Can also be a list of integers evaluated by `clamp(value, context.level)`.
+ min_width = 0,
+ -- Determines if a border is added above and below headings.
+ -- Can also be a list of booleans evaluated by `clamp(value, context.level)`.
+ border = false,
+ -- Always use virtual lines for heading borders instead of attempting to use empty lines.
+ border_virtual = false,
+ -- Highlight the start of the border using the foreground highlight.
+ border_prefix = false,
+ -- Used above heading for border.
+ above = '▄',
+ -- Used below heading for border.
+ below = '▀',
+ -- Highlight for the heading icon and extends through the entire line.
+ -- Output is evaluated by `clamp(value, context.level)`.
+ backgrounds = {
+ 'RenderMarkdownH6Bg',
+ 'RenderMarkdownH2Bg',
+ 'RenderMarkdownH3Bg',
+ 'RenderMarkdownH4Bg',
+ 'RenderMarkdownH5Bg',
+ 'RenderMarkdownH6Bg',
+ },
+ -- Highlight for the heading and sign icons.
+ -- Output is evaluated using the same logic as 'backgrounds'.
+ foregrounds = {
+ 'RenderMarkdownError',
+ 'RenderMarkdownH2',
+ 'RenderMarkdownH3',
+ 'RenderMarkdownH4',
+ 'RenderMarkdownH5',
+ 'RenderMarkdownH6',
+ },
+ -- Define custom heading patterns which allow you to override various properties based on
+ -- the contents of a heading.
+ -- The key is for healthcheck and to allow users to change its values, value type below.
+ -- | pattern | matched against the heading text @see :h lua-patterns |
+ -- | icon | optional override for the icon |
+ -- | background | optional override for the background |
+ -- | foreground | optional override for the foreground |
+ custom = {},
+ },
+ link = {
+ -- Turn on / off inline link icon rendering.
+ enabled = true,
+ -- Additional modes to render links.
+ render_modes = false,
+ -- How to handle footnote links, start with a '^'.
+ footnote = {
+ -- Turn on / off footnote rendering.
+ enabled = true,
+ -- Replace value with superscript equivalent.
+ superscript = true,
+ -- Added before link content.
+ prefix = '',
+ -- Added after link content.
+ suffix = '',
+ },
+ -- Inlined with 'image' elements.
+ image = ' ',
+ -- Inlined with 'email_autolink' elements.
+ email = ' ',
+ -- Fallback icon for 'inline_link' and 'uri_autolink' elements.
+ hyperlink = ' ',
+ -- Applies to the inlined icon as a fallback.
+ highlight = 'RenderMarkdownLink',
+ -- Applies to WikiLink elements.
+ wiki = {
+ icon = ' ',
+ body = function()
+ return nil
+ end,
+ highlight = 'RenderMarkdownWikiLink',
+ },
+ -- Define custom destination patterns so icons can quickly inform you of what a link
+ -- contains. Applies to 'inline_link', 'uri_autolink', and wikilink nodes. When multiple
+ -- patterns match a link the one with the longer pattern is used.
+ -- The key is for healthcheck and to allow users to change its values, value type below.
+ -- | pattern | matched against the destination text |
+ -- | icon | gets inlined before the link text |
+ -- | kind | optional determines how pattern is checked |
+ -- | | pattern | @see :h lua-patterns, is the default if not set |
+ -- | | suffix | @see :h vim.endswith() |
+ -- | priority | optional used when multiple match, uses pattern length if empty |
+ -- | highlight | optional highlight for 'icon', uses fallback highlight if empty |
+ custom = {
+ web = { pattern = '^http', icon = '🌐 ' },
+ github = { pattern = 'github%.com', icon = ' ' },
+ gitlab = { pattern = 'gitlab%.com', icon = ' ' },
+ stackoverflow = { pattern = 'stackoverflow%.com', icon = ' ' },
+ wikipedia = { pattern = 'wikipedia%.org', icon = ' ' },
+ youtube = { pattern = 'youtube%.com', icon = ' ' },
+ youtub = { pattern = 'youtu%.be', icon = ' ' },
+ },
+ },
+ callout = {
+ -- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
+ -- The key is for healthcheck and to allow users to change its values, value type below.
+ -- | raw | matched against the raw text of a 'shortcut_link', case insensitive |
+ -- | rendered | replaces the 'raw' value when rendering |
+ -- | highlight | highlight for the 'rendered' text and quote markers |
+ -- | quote_icon | optional override for quote.icon value for individual callout |
+ -- | category | optional metadata useful for filtering |
+
+ note = { raw = '[!NOTE]', rendered = '❕ Note', highlight = 'RenderMarkdownInfo'},
+ tip = { raw = '[!TIP]', rendered = '💡 Tip', highlight = 'RenderMarkdownSuccess'},
+ important = { raw = '[!IMPORTANT]', rendered = '‼️ Important', highlight = 'RenderMarkdownHint'},
+ warning = { raw = '[!WARNING]', rendered = '⚠️ Warning', highlight = 'RenderMarkdownWarn'},
+ caution = { raw = '[!CAUTION]', rendered = '🛑 Caution', highlight = 'RenderMarkdownError'},
+ abstract = { raw = '[!ABSTRACT]', rendered = ' Abstract', highlight = 'RenderMarkdownInfo'},
+ summary = { raw = '[!SUMMARY]', rendered = '📃 Summary', highlight = 'RenderMarkdownInfo'},
+ tldr = { raw = '[!TLDR]', rendered = ' Tldr', highlight = 'RenderMarkdownInfo'},
+ info = { raw = '[!INFO]', rendered = '🔎 Info', highlight = 'RenderMarkdownInfo'},
+ todo = { raw = '[!TODO]', rendered = '✏️ Todo', highlight = 'RenderMarkdownInfo'},
+ hint = { raw = '[!HINT]', rendered = ' Hint', highlight = 'RenderMarkdownSuccess'},
+ success = { raw = '[!SUCCESS]', rendered = '🎯 Success', highlight = 'RenderMarkdownSuccess'},
+ check = { raw = '[!CHECK]', rendered = '✔️ Check', highlight = 'RenderMarkdownSuccess'},
+ done = { raw = '[!DONE]', rendered = ' Done', highlight = 'RenderMarkdownSuccess'},
+ question = { raw = '[!QUESTION]', rendered = '❔ Question', highlight = 'RenderMarkdownWarn'},
+ help = { raw = '[!HELP]', rendered = ' Help', highlight = 'RenderMarkdownWarn'},
+ faq = { raw = '[!FAQ]', rendered = '❔ Faq', highlight = 'RenderMarkdownWarn'},
+ attention = { raw = '[!ATTENTION]', rendered = ' Attention', highlight = 'RenderMarkdownWarn'},
+ failure = { raw = '[!FAILURE]', rendered = ' Failure', highlight = 'RenderMarkdownError'},
+ fail = { raw = '[!FAIL]', rendered = ' Fail', highlight = 'RenderMarkdownError'},
+ missing = { raw = '[!MISSING]', rendered = ' Missing', highlight = 'RenderMarkdownError'},
+ danger = { raw = '[!DANGER]', rendered = ' Danger', highlight = 'RenderMarkdownError'},
+ error = { raw = '[!ERROR]', rendered = ' Error', highlight = 'RenderMarkdownError'},
+ bug = { raw = '[!BUG]', rendered = ' Bug', highlight = 'RenderMarkdownError'},
+ example = { raw = '[!EXAMPLE]', rendered = ' Example', highlight = 'RenderMarkdownHint' },
+ quote = { raw = '[!QUOTE]', rendered = ' Quote', highlight = 'RenderMarkdownQuote'},
+ cite = { raw = '[!CITE]', rendered = ' Cite', highlight = 'RenderMarkdownQuote'},
+ },
+ checkbox = {
+ enabled = true,
+ render_modes = false,
+ bullet = false,
+ right_pad = 1,
+ unchecked = {
+ icon = ' ',
+ highlight = 'RenderMarkdownUnchecked',
+ scope_highlight = nil,
+ },
+ checked = {
+ icon = ' ',
+ highlight = 'RenderMarkdownChecked',
+ scope_highlight = nil,
+ },
+ custom = {
+ todo = { raw = '[ ]', rendered = ' ', highlight = 'RenderMarkdownTodo', scope_highlight = nil },
+ },
+ },
+ bullet = {
+ enabled = true,
+ render_modes = false,
+ icons = { '●', '○', '◆', '◇' },
+ ordered_icons = function(ctx)
+ local value = vim.trim(ctx.value)
+ local index = tonumber(value:sub(1, #value - 1))
+ return ('%d.'):format(index > 1 and index or ctx.index)
+ end,
+ left_pad = 0,
+ right_pad = 0,
+ highlight = 'RenderMarkdownBullet',
+ scope_highlight = {},
+ },
+ quote = { icon = '▋' },
+ anti_conceal = {
+ enabled = true,
+ -- Which elements to always show, ignoring anti conceal behavior. Values can either be
+ -- booleans to fix the behavior or string lists representing modes where anti conceal
+ -- behavior will be ignored. Valid values are:
+ -- head_icon, head_background, head_border, code_language, code_background, code_border,
+ -- dash, bullet, check_icon, check_scope, quote, table_border, callout, link, sign
+ ignore = {
+ code_background = true,
+ sign = true,
+ },
+ above = 0,
+ below = 0,
+ },
+ code = {
+ -- Turn on / off code block & inline code rendering.
+ enabled = true,
+ -- Additional modes to render code blocks.
+ render_modes = false,
+ -- Turn on / off sign column related rendering.
+ sign = true,
+ -- Whether to conceal nodes at the top and bottom of code blocks.
+ conceal_delimiters = true,
+ -- Turn on / off language heading related rendering.
+ language = true,
+ -- Determines where language icon is rendered.
+ -- | right | right side of code block |
+ -- | left | left side of code block |
+ position = 'left',
+ -- Whether to include the language icon above code blocks.
+ language_icon = true,
+ -- Whether to include the language name above code blocks.
+ language_name = true,
+ -- Whether to include the language info above code blocks.
+ language_info = true,
+ -- Amount of padding to add around the language.
+ -- If a float < 1 is provided it is treated as a percentage of available window space.
+ language_pad = 0,
+ -- A list of language names for which background highlighting will be disabled.
+ -- Likely because that language has background highlights itself.
+ -- Use a boolean to make behavior apply to all languages.
+ -- Borders above & below blocks will continue to be rendered.
+ disable_background = { 'diff' },
+ -- Width of the code block background.
+ -- | block | width of the code block |
+ -- | full | full width of the window |
+ width = 'full',
+ -- Amount of margin to add to the left of code blocks.
+ -- If a float < 1 is provided it is treated as a percentage of available window space.
+ -- Margin available space is computed after accounting for padding.
+ left_margin = 0,
+ -- Amount of padding to add to the left of code blocks.
+ -- If a float < 1 is provided it is treated as a percentage of available window space.
+ left_pad = 0,
+ -- Amount of padding to add to the right of code blocks when width is 'block'.
+ -- If a float < 1 is provided it is treated as a percentage of available window space.
+ right_pad = 0,
+ -- Minimum width to use for code blocks when width is 'block'.
+ min_width = 0,
+ -- Determines how the top / bottom of code block are rendered.
+ -- | none | do not render a border |
+ -- | thick | use the same highlight as the code body |
+ -- | thin | when lines are empty overlay the above & below icons |
+ -- | hide | conceal lines unless language name or icon is added |
+ border = 'hide',
+ -- Used above code blocks to fill remaining space around language.
+ language_border = '█',
+ -- Added to the left of language.
+ language_left = '',
+ -- Added to the right of language.
+ language_right = '',
+ -- Used above code blocks for thin border.
+ above = '▄',
+ -- Used below code blocks for thin border.
+ below = '▀',
+ -- Turn on / off inline code related rendering.
+ inline = true,
+ -- Icon to add to the left of inline code.
+ inline_left = '',
+ -- Icon to add to the right of inline code.
+ inline_right = '',
+ -- Padding to add to the left & right of inline code.
+ inline_pad = 0,
+ -- Priority to assign to code background highlight.
+ priority = nil,
+ -- Highlight for code blocks.
+ highlight = 'RenderMarkdownCode',
+ -- Highlight for code info section, after the language.
+ highlight_info = 'RenderMarkdownCodeInfo',
+ -- Highlight for language, overrides icon provider value.
+ highlight_language = nil,
+ -- Highlight for border, use false to add no highlight.
+ highlight_border = 'RenderMarkdownCodeBorder',
+ -- Highlight for language, used if icon provider does not have a value.
+ highlight_fallback = 'RenderMarkdownCodeFallback',
+ -- Highlight for inline code.
+ highlight_inline = 'RenderMarkdownCodeInline',
+ -- Determines how code blocks & inline code are rendered.
+ -- | none | { enabled = false } |
+ -- | normal | { language = false } |
+ -- | language | { disable_background = true, inline = false } |
+ -- | full | uses all default values |
+ style = 'full',
+ },
+ dash = {
+ -- Useful context to have when evaluating values.
+ -- | width | width of the current window |
+ -- Turn on / off thematic break rendering.
+ enabled = true,
+ -- Additional modes to render dash.
+ render_modes = false,
+ -- Replaces '---'|'***'|'___'|'* * *' of 'thematic_break'.
+ -- The icon gets repeated across the window's width.
+ icon = '─',
+ -- Width of the generated line.
+ -- If a float < 1 is provided it is treated as a percentage of available window space.
+ -- Output is evaluated depending on the type.
+ -- | function | `value(context)` |
+ -- | number | `value` |
+ -- | full | width of the window |
+ width = 'full',
+ -- Amount of margin to add to the left of dash.
+ -- If a float < 1 is provided it is treated as a percentage of available window space.
+ left_margin = 0,
+ -- Highlight for the whole line generated from the icon.
+ highlight = 'RenderMarkdownDash',
+ },
+})