summaryrefslogtreecommitdiff
path: root/config/nvim-1/lua/plugins/render-markdown/init.lua
blob: ab078ce92710aa9041a8e88de3158049f807f3c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
require("render-markdown").setup({
	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 = "󰗃 " },
		},
	},
	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,
	},
})