Skip to content

Commit b540997

Browse files
chore(refactor): handle legacy styles like presets
## Details For `code.style` & `pipe_table.style` handle them like presets, meaning set other configuration options to dictate behavior and rely on these when rendering. This avoids having multiple ways of accomplishing the same thing at least within the logic, users do end up having multiple options available to them. Update the documentation for the styles to point to the values they are setting under the hood. Additional options were added to fill a couple gaps with style behavior: - `code.inline`: lets you turn off inline code rendering (`language`) - `pipe_table.border_enabled`: lets you turn off the borders above and below tables (`normal`) Otherwise the `none` values set `enabled = false`. `full` in both cases adopts the default configuration so does not modify anything. Given the rather limited value these provide, I may deprecate them at a future date. For now moving them to the bottom of their configurations to avoid attracting any new users.
1 parent 3254863 commit b540997

File tree

15 files changed

+231
-233
lines changed

15 files changed

+231
-233
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- more anti_conceal.ignore elements [b8c3d47](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/b8c3d474d4da14fa1a5f9a0a18955c6e7db88f65)
99
- allow users to disable code block delimiter concealing [7620d4e](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/7620d4e96eb5cf8d12e76c6fcaf1267628564ba9)
1010
- improve completions [#474](https://github.com/MeanderingProgrammer/render-markdown.nvim/pull/474)
11+
[3254863](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/3254863eb91fed3d9a7433b54327716528f1eacc)
1112

1213
### Collaborator Shoutouts
1314

README.md

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ require('render-markdown').setup({
188188
-- unaffected by this plugin.
189189
render_modes = { 'n', 'c', 't' },
190190
-- Maximum file size (in MB) that this plugin will attempt to render.
191-
-- Any file larger than this will effectively be ignored.
191+
-- File larger than this will effectively be ignored.
192192
max_file_size = 10.0,
193193
-- Milliseconds that must pass before updating marks, updates occur.
194194
-- within the context of the visible window, not the entire buffer.
195195
debounce = 100,
196196
-- Pre configured settings that will attempt to mimic various target user experiences.
197-
-- Any user provided settings will take precedence.
197+
-- User provided settings will take precedence.
198198
-- | obsidian | mimic Obsidian UI |
199199
-- | lazy | will attempt to stay up to date with LazyVim configuration |
200200
-- | none | does nothing |
@@ -240,7 +240,7 @@ require('render-markdown').setup({
240240
},
241241
},
242242
anti_conceal = {
243-
-- This enables hiding any added text on the line the cursor is on.
243+
-- This enables hiding added text on the line the cursor is on.
244244
enabled = true,
245245
-- Modes to disable anti conceal feature.
246246
disabled_modes = false,
@@ -333,17 +333,17 @@ require('render-markdown').setup({
333333
atx = true,
334334
-- Turn on / off setext heading rendering.
335335
setext = true,
336-
-- Turn on / off any sign column related rendering.
336+
-- Turn on / off sign column related rendering.
337337
sign = true,
338338
-- Replaces '#+' of 'atx_h._marker'.
339339
-- Output is evaluated depending on the type.
340340
-- | function | `value(context)` |
341341
-- | string[] | `cycle(value, context.level)` |
342342
icons = { '󰲡 ', '󰲣 ', '󰲥 ', '󰲧 ', '󰲩 ', '󰲫 ' },
343343
-- Determines how icons fill the available space.
344-
-- | right | '#'s are concealed and icon is appended to right side |
345-
-- | inline | '#'s are concealed and icon is inlined on left side |
346-
-- | overlay | icon is left padded with spaces and inserted on left hiding any additional '#' |
344+
-- | right | '#'s are concealed and icon is appended to right side |
345+
-- | inline | '#'s are concealed and icon is inlined on left side |
346+
-- | overlay | icon is left padded with spaces and inserted on left hiding additional '#' |
347347
position = 'overlay',
348348
-- Added to the sign column if enabled.
349349
-- Output is evaluated by `cycle(value, context.level)`.
@@ -432,17 +432,11 @@ require('render-markdown').setup({
432432
enabled = true,
433433
-- Additional modes to render code blocks.
434434
render_modes = false,
435-
-- Turn on / off any sign column related rendering.
435+
-- Turn on / off sign column related rendering.
436436
sign = true,
437-
-- Determines how code blocks & inline code are rendered.
438-
-- | none | disables all rendering |
439-
-- | normal | background highlighting + padding |
440-
-- | language | language heading with icon + sign column |
441-
-- | full | normal + language |
442-
style = 'full',
443437
-- Whether to conceal nodes at the top and bottom of code blocks.
444438
conceal_delimiters = true,
445-
-- Turn on / off any language heading related rendering.
439+
-- Turn on / off language heading related rendering.
446440
language = true,
447441
-- Determines where language icon is rendered.
448442
-- | right | right side of code block |
@@ -494,6 +488,8 @@ require('render-markdown').setup({
494488
above = '',
495489
-- Used below code blocks for thin border.
496490
below = '',
491+
-- Turn on / off inline code related rendering.
492+
inline = true,
497493
-- Icon to add to the left of inline code.
498494
inline_left = '',
499495
-- Icon to add to the right of inline code.
@@ -512,6 +508,12 @@ require('render-markdown').setup({
512508
highlight_fallback = 'RenderMarkdownCodeFallback',
513509
-- Highlight for inline code.
514510
highlight_inline = 'RenderMarkdownCodeInline',
511+
-- Determines how code blocks & inline code are rendered.
512+
-- | none | { enabled = false } |
513+
-- | normal | { language = false } |
514+
-- | language | { disable_background = true, inline = false } |
515+
-- | full | uses all default values |
516+
style = 'full',
515517
},
516518
dash = {
517519
-- Turn on / off thematic break rendering.
@@ -664,11 +666,6 @@ require('render-markdown').setup({
664666
-- | round | use round border corners |
665667
-- | none | does nothing |
666668
preset = 'none',
667-
-- Determines how the table as a whole is rendered.
668-
-- | none | disables all rendering |
669-
-- | normal | applies the 'cell' style rendering to each row of the table |
670-
-- | full | normal + a top & bottom line that fill out the table when lengths match |
671-
style = 'full',
672669
-- Determines how individual cells of a table are rendered.
673670
-- | overlay | writes completely over the table, removing conceal behavior and highlights |
674671
-- | raw | replaces only the '|' characters in each row, leaving the cells unmodified |
@@ -688,6 +685,8 @@ require('render-markdown').setup({
688685
'', '', '',
689686
'', '',
690687
},
688+
-- Turn on / off top & bottom lines.
689+
border_enabled = true,
691690
-- Always use virtual lines for table borders instead of attempting to use empty lines.
692691
-- Will be automatically enabled if indentation module is enabled.
693692
border_virtual = false,
@@ -699,6 +698,11 @@ require('render-markdown').setup({
699698
row = 'RenderMarkdownTableRow',
700699
-- Highlight for inline padding used to add back concealed space.
701700
filler = 'RenderMarkdownTableFill',
701+
-- Determines how the table as a whole is rendered.
702+
-- | none | { enabled = false } |
703+
-- | normal | { border_enabled = false } |
704+
-- | full | uses all default values |
705+
style = 'full',
702706
},
703707
callout = {
704708
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
@@ -930,17 +934,17 @@ require('render-markdown').setup({
930934
atx = true,
931935
-- Turn on / off setext heading rendering.
932936
setext = true,
933-
-- Turn on / off any sign column related rendering.
937+
-- Turn on / off sign column related rendering.
934938
sign = true,
935939
-- Replaces '#+' of 'atx_h._marker'.
936940
-- Output is evaluated depending on the type.
937941
-- | function | `value(context)` |
938942
-- | string[] | `cycle(value, context.level)` |
939943
icons = { '󰲡 ', '󰲣 ', '󰲥 ', '󰲧 ', '󰲩 ', '󰲫 ' },
940944
-- Determines how icons fill the available space.
941-
-- | right | '#'s are concealed and icon is appended to right side |
942-
-- | inline | '#'s are concealed and icon is inlined on left side |
943-
-- | overlay | icon is left padded with spaces and inserted on left hiding any additional '#' |
945+
-- | right | '#'s are concealed and icon is appended to right side |
946+
-- | inline | '#'s are concealed and icon is inlined on left side |
947+
-- | overlay | icon is left padded with spaces and inserted on left hiding additional '#' |
944948
position = 'overlay',
945949
-- Added to the sign column if enabled.
946950
-- Output is evaluated by `cycle(value, context.level)`.
@@ -1059,17 +1063,11 @@ require('render-markdown').setup({
10591063
enabled = true,
10601064
-- Additional modes to render code blocks.
10611065
render_modes = false,
1062-
-- Turn on / off any sign column related rendering.
1066+
-- Turn on / off sign column related rendering.
10631067
sign = true,
1064-
-- Determines how code blocks & inline code are rendered.
1065-
-- | none | disables all rendering |
1066-
-- | normal | background highlighting + padding |
1067-
-- | language | language heading with icon + sign column |
1068-
-- | full | normal + language |
1069-
style = 'full',
10701068
-- Whether to conceal nodes at the top and bottom of code blocks.
10711069
conceal_delimiters = true,
1072-
-- Turn on / off any language heading related rendering.
1070+
-- Turn on / off language heading related rendering.
10731071
language = true,
10741072
-- Determines where language icon is rendered.
10751073
-- | right | right side of code block |
@@ -1121,6 +1119,8 @@ require('render-markdown').setup({
11211119
above = '',
11221120
-- Used below code blocks for thin border.
11231121
below = '',
1122+
-- Turn on / off inline code related rendering.
1123+
inline = true,
11241124
-- Icon to add to the left of inline code.
11251125
inline_left = '',
11261126
-- Icon to add to the right of inline code.
@@ -1139,6 +1139,12 @@ require('render-markdown').setup({
11391139
highlight_fallback = 'RenderMarkdownCodeFallback',
11401140
-- Highlight for inline code.
11411141
highlight_inline = 'RenderMarkdownCodeInline',
1142+
-- Determines how code blocks & inline code are rendered.
1143+
-- | none | { enabled = false } |
1144+
-- | normal | { language = false } |
1145+
-- | language | { disable_background = true, inline = false } |
1146+
-- | full | uses all default values |
1147+
style = 'full',
11421148
},
11431149
})
11441150
```
@@ -1352,11 +1358,6 @@ require('render-markdown').setup({
13521358
-- | round | use round border corners |
13531359
-- | none | does nothing |
13541360
preset = 'none',
1355-
-- Determines how the table as a whole is rendered.
1356-
-- | none | disables all rendering |
1357-
-- | normal | applies the 'cell' style rendering to each row of the table |
1358-
-- | full | normal + a top & bottom line that fill out the table when lengths match |
1359-
style = 'full',
13601361
-- Determines how individual cells of a table are rendered.
13611362
-- | overlay | writes completely over the table, removing conceal behavior and highlights |
13621363
-- | raw | replaces only the '|' characters in each row, leaving the cells unmodified |
@@ -1376,6 +1377,8 @@ require('render-markdown').setup({
13761377
'', '', '',
13771378
'', '',
13781379
},
1380+
-- Turn on / off top & bottom lines.
1381+
border_enabled = true,
13791382
-- Always use virtual lines for table borders instead of attempting to use empty lines.
13801383
-- Will be automatically enabled if indentation module is enabled.
13811384
border_virtual = false,
@@ -1387,6 +1390,11 @@ require('render-markdown').setup({
13871390
row = 'RenderMarkdownTableRow',
13881391
-- Highlight for inline padding used to add back concealed space.
13891392
filler = 'RenderMarkdownTableFill',
1393+
-- Determines how the table as a whole is rendered.
1394+
-- | none | { enabled = false } |
1395+
-- | normal | { border_enabled = false } |
1396+
-- | full | uses all default values |
1397+
style = 'full',
13901398
},
13911399
})
13921400
```

0 commit comments

Comments
 (0)