1
+ local colors = require (' render-markdown.colors' )
1
2
local manager = require (' render-markdown.manager' )
2
3
local state = require (' render-markdown.state' )
3
4
@@ -193,7 +194,7 @@ M.default_config = {
193
194
-- Executable used to convert latex formula to rendered unicode
194
195
converter = ' latex2text' ,
195
196
-- Highlight for LaTeX blocks
196
- highlight = ' @markup.math ' ,
197
+ highlight = ' RenderMarkdownMath ' ,
197
198
},
198
199
heading = {
199
200
-- Turn on / off heading icon & background rendering
@@ -210,16 +211,16 @@ M.default_config = {
210
211
signs = { ' ' },
211
212
-- The 'level' is used to index into the array using a clamp
212
213
-- Highlight for the heading icon and extends through the entire line
213
- backgrounds = { ' DiffAdd ' , ' DiffChange ' , ' DiffDelete ' },
214
+ backgrounds = { ' RenderMarkdownH1Bg ' , ' RenderMarkdownH2Bg ' , ' RenderMarkdownH3Bg ' },
214
215
-- The 'level' is used to index into the array using a clamp
215
216
-- Highlight for the heading and sign icons
216
217
foregrounds = {
217
- ' @markup.heading.1.markdown ' ,
218
- ' @markup.heading.2.markdown ' ,
219
- ' @markup.heading.3.markdown ' ,
220
- ' @markup.heading.4.markdown ' ,
221
- ' @markup.heading.5.markdown ' ,
222
- ' @markup.heading.6.markdown ' ,
218
+ ' RenderMarkdownH1 ' ,
219
+ ' RenderMarkdownH2 ' ,
220
+ ' RenderMarkdownH3 ' ,
221
+ ' RenderMarkdownH4 ' ,
222
+ ' RenderMarkdownH5 ' ,
223
+ ' RenderMarkdownH6 ' ,
223
224
},
224
225
},
225
226
code = {
@@ -244,7 +245,7 @@ M.default_config = {
244
245
-- Used below code blocks for thin border
245
246
below = ' ▀' ,
246
247
-- Highlight for code blocks & inline code
247
- highlight = ' ColorColumn ' ,
248
+ highlight = ' RenderMarkdownCode ' ,
248
249
},
249
250
dash = {
250
251
-- Turn on / off thematic break rendering
@@ -253,7 +254,7 @@ M.default_config = {
253
254
-- The icon gets repeated across the window's width
254
255
icon = ' ─' ,
255
256
-- Highlight for the whole line generated from the icon
256
- highlight = ' LineNr ' ,
257
+ highlight = ' RenderMarkdownDash ' ,
257
258
},
258
259
bullet = {
259
260
-- Turn on / off list bullet rendering
@@ -264,7 +265,7 @@ M.default_config = {
264
265
-- If the item is a 'checkbox' a conceal is used to hide the bullet instead
265
266
icons = { ' ●' , ' ○' , ' ◆' , ' ◇' },
266
267
-- Highlight for the bullet icon
267
- highlight = ' Normal ' ,
268
+ highlight = ' RenderMarkdownBullet ' ,
268
269
},
269
270
-- Checkboxes are a special instance of a 'list_item' that start with a 'shortcut_link'
270
271
-- There are two special states for unchecked & checked defined in the markdown grammar
@@ -275,13 +276,13 @@ M.default_config = {
275
276
-- Replaces '[ ]' of 'task_list_marker_unchecked'
276
277
icon = ' ' ,
277
278
-- Highlight for the unchecked icon
278
- highlight = ' @markup.list.unchecked ' ,
279
+ highlight = ' RenderMarkdownUnchecked ' ,
279
280
},
280
281
checked = {
281
282
-- Replaces '[x]' of 'task_list_marker_checked'
282
283
icon = ' ' ,
283
284
-- Highligh for the checked icon
284
- highlight = ' @markup.heading ' ,
285
+ highlight = ' RenderMarkdownChecked ' ,
285
286
},
286
287
-- Define custom checkbox states, more involved as they are not part of the markdown grammar
287
288
-- As a result this requires neovim >= 0.10.0 since it relies on 'inline' extmarks
@@ -291,7 +292,7 @@ M.default_config = {
291
292
-- 'rendered': Replaces the 'raw' value when rendering
292
293
-- 'highlight': Highlight for the 'rendered' icon
293
294
custom = {
294
- todo = { raw = ' [-]' , rendered = ' ' , highlight = ' @markup.raw ' },
295
+ todo = { raw = ' [-]' , rendered = ' ' , highlight = ' RenderMarkdownTodo ' },
295
296
},
296
297
},
297
298
quote = {
@@ -300,7 +301,7 @@ M.default_config = {
300
301
-- Replaces '>' of 'block_quote'
301
302
icon = ' ▋' ,
302
303
-- Highlight for the quote icon
303
- highlight = ' @markup.quote ' ,
304
+ highlight = ' RenderMarkdownQuote ' ,
304
305
},
305
306
pipe_table = {
306
307
-- Turn on / off pipe table rendering
@@ -325,11 +326,11 @@ M.default_config = {
325
326
' │' , ' ─' ,
326
327
},
327
328
-- Highlight for table heading, delimiter, and the line above
328
- head = ' @markup.heading ' ,
329
+ head = ' RenderMarkdownTableHead ' ,
329
330
-- Highlight for everything else, main table rows and the line below
330
- row = ' Normal ' ,
331
+ row = ' RenderMarkdownTableRow ' ,
331
332
-- Highlight for inline padding used to add back concealed space
332
- filler = ' Conceal ' ,
333
+ filler = ' RenderMarkdownTableFill ' ,
333
334
},
334
335
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'
335
336
-- Can specify as many additional values as you like following the pattern from any below, such as 'note'
@@ -338,21 +339,21 @@ M.default_config = {
338
339
-- 'rendered': Replaces the 'raw' value when rendering
339
340
-- 'highlight': Highlight for the 'rendered' text and quote markers
340
341
callout = {
341
- note = { raw = ' [!NOTE]' , rendered = ' Note' , highlight = ' DiagnosticInfo ' },
342
- tip = { raw = ' [!TIP]' , rendered = ' Tip' , highlight = ' DiagnosticOk ' },
343
- important = { raw = ' [!IMPORTANT]' , rendered = ' Important' , highlight = ' DiagnosticHint ' },
344
- warning = { raw = ' [!WARNING]' , rendered = ' Warning' , highlight = ' DiagnosticWarn ' },
345
- caution = { raw = ' [!CAUTION]' , rendered = ' Caution' , highlight = ' DiagnosticError ' },
342
+ note = { raw = ' [!NOTE]' , rendered = ' Note' , highlight = ' RenderMarkdownInfo ' },
343
+ tip = { raw = ' [!TIP]' , rendered = ' Tip' , highlight = ' RenderMarkdownSuccess ' },
344
+ important = { raw = ' [!IMPORTANT]' , rendered = ' Important' , highlight = ' RenderMarkdownHint ' },
345
+ warning = { raw = ' [!WARNING]' , rendered = ' Warning' , highlight = ' RenderMarkdownWarn ' },
346
+ caution = { raw = ' [!CAUTION]' , rendered = ' Caution' , highlight = ' RenderMarkdownError ' },
346
347
-- Obsidian: https://help.a.md/Editing+and+formatting/Callouts
347
- abstract = { raw = ' [!ABSTRACT]' , rendered = ' Abstract' , highlight = ' DiagnosticInfo ' },
348
- todo = { raw = ' [!TODO]' , rendered = ' Todo' , highlight = ' DiagnosticInfo ' },
349
- success = { raw = ' [!SUCCESS]' , rendered = ' Success' , highlight = ' DiagnosticOk ' },
350
- question = { raw = ' [!QUESTION]' , rendered = ' Question' , highlight = ' DiagnosticWarn ' },
351
- failure = { raw = ' [!FAILURE]' , rendered = ' Failure' , highlight = ' DiagnosticError ' },
352
- danger = { raw = ' [!DANGER]' , rendered = ' Danger' , highlight = ' DiagnosticError ' },
353
- bug = { raw = ' [!BUG]' , rendered = ' Bug' , highlight = ' DiagnosticError ' },
354
- example = { raw = ' [!EXAMPLE]' , rendered = ' Example' , highlight = ' DiagnosticHint ' },
355
- quote = { raw = ' [!QUOTE]' , rendered = ' Quote' , highlight = ' @markup.quote ' },
348
+ abstract = { raw = ' [!ABSTRACT]' , rendered = ' Abstract' , highlight = ' RenderMarkdownInfo ' },
349
+ todo = { raw = ' [!TODO]' , rendered = ' Todo' , highlight = ' RenderMarkdownInfo ' },
350
+ success = { raw = ' [!SUCCESS]' , rendered = ' Success' , highlight = ' RenderMarkdownSuccess ' },
351
+ question = { raw = ' [!QUESTION]' , rendered = ' Question' , highlight = ' RenderMarkdownWarn ' },
352
+ failure = { raw = ' [!FAILURE]' , rendered = ' Failure' , highlight = ' RenderMarkdownError ' },
353
+ danger = { raw = ' [!DANGER]' , rendered = ' Danger' , highlight = ' RenderMarkdownError ' },
354
+ bug = { raw = ' [!BUG]' , rendered = ' Bug' , highlight = ' RenderMarkdownError ' },
355
+ example = { raw = ' [!EXAMPLE]' , rendered = ' Example' , highlight = ' RenderMarkdownHint ' },
356
+ quote = { raw = ' [!QUOTE]' , rendered = ' Quote' , highlight = ' RenderMarkdownQuote ' },
356
357
},
357
358
link = {
358
359
-- Turn on / off inline link icon rendering
@@ -362,7 +363,7 @@ M.default_config = {
362
363
-- Inlined with 'inline_link' elements
363
364
hyperlink = ' ' ,
364
365
-- Applies to the inlined icon
365
- highlight = ' @markup.link.label.markdown_inline ' ,
366
+ highlight = ' RenderMarkdownLink ' ,
366
367
},
367
368
sign = {
368
369
-- Turn on / off sign rendering
@@ -372,7 +373,7 @@ M.default_config = {
372
373
buftypes = { ' nofile' },
373
374
},
374
375
-- Applies to background of sign text
375
- highlight = ' SignColumn ' ,
376
+ highlight = ' RenderMarkdownSign ' ,
376
377
},
377
378
-- Window options to use that change between rendered and raw view
378
379
win_options = {
@@ -407,6 +408,7 @@ function M.setup(opts)
407
408
state .inline_link_query = vim .treesitter .query .parse (' markdown_inline' , state .config .inline_link_query )
408
409
end )
409
410
411
+ colors .setup ()
410
412
manager .setup ()
411
413
412
414
vim .api .nvim_create_user_command (' RenderMarkdown' , M .command , {
0 commit comments