Skip to content

Commit 85edcba

Browse files
chore(refactor): store default configurations per component rather all in init.lua
1 parent 78ffe3b commit 85edcba

35 files changed

+1055
-890
lines changed

README.md

Lines changed: 70 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,11 @@ require('render-markdown').setup({
210210
end,
211211
-- Additional events that will trigger this plugin's render loop.
212212
change_events = {},
213-
-- Out of the box language injections for known filetypes that allow markdown to be interpreted
214-
-- in specified locations, see :h treesitter-language-injections.
215-
-- Set enabled to false in order to disable.
216213
injections = {
214+
-- Out of the box language injections for known filetypes that allow markdown to be interpreted
215+
-- in specified locations, see :h treesitter-language-injections.
216+
-- Set enabled to false in order to disable.
217+
217218
gitcommit = {
218219
enabled = true,
219220
query = [[
@@ -224,8 +225,9 @@ require('render-markdown').setup({
224225
]],
225226
},
226227
},
227-
-- Highlight patterns to disable for filetypes, i.e. lines concealed around code blocks
228228
patterns = {
229+
-- Highlight patterns to disable for filetypes, i.e. lines concealed around code blocks
230+
229231
markdown = {
230232
disable = true,
231233
directives = {
@@ -301,10 +303,11 @@ require('render-markdown').setup({
301303
end,
302304
},
303305
},
304-
-- Useful context to have when evaluating values.
305-
-- | level | the number of '#' in the heading marker |
306-
-- | sections | for each level how deeply nested the heading is |
307306
heading = {
307+
-- Useful context to have when evaluating values.
308+
-- | level | the number of '#' in the heading marker |
309+
-- | sections | for each level how deeply nested the heading is |
310+
308311
-- Turn on / off heading icon & background rendering.
309312
enabled = true,
310313
-- Additional modes to render headings.
@@ -387,9 +390,10 @@ require('render-markdown').setup({
387390
-- | foreground | optional override for the foreground |
388391
custom = {},
389392
},
390-
-- Useful context to have when evaluating values.
391-
-- | text | text value of the node |
392393
paragraph = {
394+
-- Useful context to have when evaluating values.
395+
-- | text | text value of the node |
396+
393397
-- Turn on / off paragraph rendering.
394398
enabled = true,
395399
-- Additional modes to render paragraphs.
@@ -508,11 +512,12 @@ require('render-markdown').setup({
508512
line_patterns = {},
509513
},
510514
},
511-
-- Useful context to have when evaluating values.
512-
-- | level | how deeply nested the list is, 1-indexed |
513-
-- | index | how far down the item is at that level, 1-indexed |
514-
-- | value | text value of the marker node |
515515
bullet = {
516+
-- Useful context to have when evaluating values.
517+
-- | level | how deeply nested the list is, 1-indexed |
518+
-- | index | how far down the item is at that level, 1-indexed |
519+
-- | value | text value of the marker node |
520+
516521
-- Turn on / off list bullet rendering
517522
enabled = true,
518523
-- Additional modes to render list bullets
@@ -547,9 +552,10 @@ require('render-markdown').setup({
547552
-- Output is evaluated using the same logic as 'icons'.
548553
scope_highlight = {},
549554
},
550-
-- Checkboxes are a special instance of a 'list_item' that start with a 'shortcut_link'.
551-
-- There are two special states for unchecked & checked defined in the markdown grammar.
552555
checkbox = {
556+
-- Checkboxes are a special instance of a 'list_item' that start with a 'shortcut_link'.
557+
-- There are two special states for unchecked & checked defined in the markdown grammar.
558+
553559
-- Turn on / off checkbox state rendering.
554560
enabled = true,
555561
-- Additional modes to render checkboxes.
@@ -655,15 +661,15 @@ require('render-markdown').setup({
655661
-- Highlight for inline padding used to add back concealed space.
656662
filler = 'RenderMarkdownTableFill',
657663
},
658-
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
659-
-- The key is for healthcheck and to allow users to change its values, value type below.
660-
-- | raw | matched against the raw text of a 'shortcut_link', case insensitive |
661-
-- | rendered | replaces the 'raw' value when rendering |
662-
-- | highlight | highlight for the 'rendered' text and quote markers |
663-
-- | quote_icon | optional override for quote.icon value for individual callout |
664-
-- | category | optional metadata useful for filtering |
665-
-- stylua: ignore
666664
callout = {
665+
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
666+
-- The key is for healthcheck and to allow users to change its values, value type below.
667+
-- | raw | matched against the raw text of a 'shortcut_link', case insensitive |
668+
-- | rendered | replaces the 'raw' value when rendering |
669+
-- | highlight | highlight for the 'rendered' text and quote markers |
670+
-- | quote_icon | optional override for quote.icon value for individual callout |
671+
-- | category | optional metadata useful for filtering |
672+
667673
note = { raw = '[!NOTE]', rendered = '󰋽 Note', highlight = 'RenderMarkdownInfo', category = 'github' },
668674
tip = { raw = '[!TIP]', rendered = '󰌶 Tip', highlight = 'RenderMarkdownSuccess', category = 'github' },
669675
important = { raw = '[!IMPORTANT]', rendered = '󰅾 Important', highlight = 'RenderMarkdownHint', category = 'github' },
@@ -755,19 +761,21 @@ require('render-markdown').setup({
755761
-- Applies to background of sign text.
756762
highlight = 'RenderMarkdownSign',
757763
},
758-
-- Mimics Obsidian inline highlights when content is surrounded by double equals.
759-
-- The equals on both ends are concealed and the inner content is highlighted.
760764
inline_highlight = {
765+
-- Mimics Obsidian inline highlights when content is surrounded by double equals.
766+
-- The equals on both ends are concealed and the inner content is highlighted.
767+
761768
-- Turn on / off inline highlight rendering.
762769
enabled = true,
763770
-- Additional modes to render inline highlights.
764771
render_modes = false,
765772
-- Applies to background of surrounded text.
766773
highlight = 'RenderMarkdownInlineHighlight',
767774
},
768-
-- Mimic org-indent-mode behavior by indenting everything under a heading based on the level of
769-
-- the heading. Indenting starts from level 2 headings onward by default.
770775
indent = {
776+
-- Mimic org-indent-mode behavior by indenting everything under a heading based on the
777+
-- level of the heading. Indenting starts from level 2 headings onward by default.
778+
771779
-- Turn on / off org-indent-mode.
772780
enabled = false,
773781
-- Additional modes to render indents.
@@ -803,8 +811,9 @@ require('render-markdown').setup({
803811
-- | highlight | highlight for the icon |
804812
tag = {},
805813
},
806-
-- Window options to use that change between rendered and raw view.
807814
win_options = {
815+
-- Window options to use that change between rendered and raw view.
816+
808817
-- @see :h 'conceallevel'
809818
conceallevel = {
810819
-- Used when not being rendered, get user setting.
@@ -820,13 +829,14 @@ require('render-markdown').setup({
820829
rendered = '',
821830
},
822831
},
823-
-- More granular configuration mechanism, allows different aspects of buffers to have their own
824-
-- behavior. Values default to the top level configuration if no override is provided. Supports
825-
-- the following fields:
826-
-- enabled, max_file_size, debounce, render_modes, anti_conceal, padding, heading, paragraph,
827-
-- code, dash, bullet, checkbox, quote, pipe_table, callout, link, sign, indent, latex, html,
828-
-- win_options
829832
overrides = {
833+
-- More granular configuration mechanism, allows different aspects of buffers to have their own
834+
-- behavior. Values default to the top level configuration if no override is provided. Supports
835+
-- the following fields:
836+
-- enabled, max_file_size, debounce, render_modes, anti_conceal, padding, heading, paragraph,
837+
-- code, dash, bullet, checkbox, quote, pipe_table, callout, link, sign, indent, latex, html,
838+
-- win_options
839+
830840
-- Override for different buflisted values, @see :h 'buflisted'.
831841
buflisted = {},
832842
-- Override for different buftype values, @see :h 'buftype'.
@@ -865,10 +875,11 @@ We use the following definitions when discussing indexing into lists:
865875

866876
```lua
867877
require('render-markdown').setup({
868-
-- Useful context to have when evaluating values.
869-
-- | level | the number of '#' in the heading marker |
870-
-- | sections | for each level how deeply nested the heading is |
871878
heading = {
879+
-- Useful context to have when evaluating values.
880+
-- | level | the number of '#' in the heading marker |
881+
-- | sections | for each level how deeply nested the heading is |
882+
872883
-- Turn on / off heading icon & background rendering.
873884
enabled = true,
874885
-- Additional modes to render headings.
@@ -966,9 +977,10 @@ require('render-markdown').setup({
966977

967978
```lua
968979
require('render-markdown').setup({
969-
-- Useful context to have when evaluating values.
970-
-- | text | text value of the node |
971980
paragraph = {
981+
-- Useful context to have when evaluating values.
982+
-- | text | text value of the node |
983+
972984
-- Turn on / off paragraph rendering.
973985
enabled = true,
974986
-- Additional modes to render paragraphs.
@@ -1118,11 +1130,12 @@ require('render-markdown').setup({
11181130

11191131
```lua
11201132
require('render-markdown').setup({
1121-
-- Useful context to have when evaluating values.
1122-
-- | level | how deeply nested the list is, 1-indexed |
1123-
-- | index | how far down the item is at that level, 1-indexed |
1124-
-- | value | text value of the marker node |
11251133
bullet = {
1134+
-- Useful context to have when evaluating values.
1135+
-- | level | how deeply nested the list is, 1-indexed |
1136+
-- | index | how far down the item is at that level, 1-indexed |
1137+
-- | value | text value of the marker node |
1138+
11261139
-- Turn on / off list bullet rendering
11271140
enabled = true,
11281141
-- Additional modes to render list bullets
@@ -1172,9 +1185,10 @@ require('render-markdown').setup({
11721185

11731186
```lua
11741187
require('render-markdown').setup({
1175-
-- Checkboxes are a special instance of a 'list_item' that start with a 'shortcut_link'.
1176-
-- There are two special states for unchecked & checked defined in the markdown grammar.
11771188
checkbox = {
1189+
-- Checkboxes are a special instance of a 'list_item' that start with a 'shortcut_link'.
1190+
-- There are two special states for unchecked & checked defined in the markdown grammar.
1191+
11781192
-- Turn on / off checkbox state rendering.
11791193
enabled = true,
11801194
-- Additional modes to render checkboxes.
@@ -1325,15 +1339,15 @@ require('render-markdown').setup({
13251339

13261340
```lua
13271341
require('render-markdown').setup({
1328-
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
1329-
-- The key is for healthcheck and to allow users to change its values, value type below.
1330-
-- | raw | matched against the raw text of a 'shortcut_link', case insensitive |
1331-
-- | rendered | replaces the 'raw' value when rendering |
1332-
-- | highlight | highlight for the 'rendered' text and quote markers |
1333-
-- | quote_icon | optional override for quote.icon value for individual callout |
1334-
-- | category | optional metadata useful for filtering |
1335-
-- stylua: ignore
13361342
callout = {
1343+
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
1344+
-- The key is for healthcheck and to allow users to change its values, value type below.
1345+
-- | raw | matched against the raw text of a 'shortcut_link', case insensitive |
1346+
-- | rendered | replaces the 'raw' value when rendering |
1347+
-- | highlight | highlight for the 'rendered' text and quote markers |
1348+
-- | quote_icon | optional override for quote.icon value for individual callout |
1349+
-- | category | optional metadata useful for filtering |
1350+
13371351
note = { raw = '[!NOTE]', rendered = '󰋽 Note', highlight = 'RenderMarkdownInfo', category = 'github' },
13381352
tip = { raw = '[!TIP]', rendered = '󰌶 Tip', highlight = 'RenderMarkdownSuccess', category = 'github' },
13391353
important = { raw = '[!IMPORTANT]', rendered = '󰅾 Important', highlight = 'RenderMarkdownHint', category = 'github' },
@@ -1470,9 +1484,10 @@ require('render-markdown').setup({
14701484

14711485
```lua
14721486
require('render-markdown').setup({
1473-
-- Mimic org-indent-mode behavior by indenting everything under a heading based on the level of
1474-
-- the heading. Indenting starts from level 2 headings onward by default.
14751487
indent = {
1488+
-- Mimic org-indent-mode behavior by indenting everything under a heading based on the
1489+
-- level of the heading. Indenting starts from level 2 headings onward by default.
1490+
14761491
-- Turn on / off org-indent-mode.
14771492
enabled = false,
14781493
-- Additional modes to render indents.

0 commit comments

Comments
 (0)