Skip to content

Commit 8314d14

Browse files
feat: toggle WikiLink rendering via enabled flag
## Details Allows WikiLink rendering to be toggled on / off, similar to footnotes.
1 parent c54380d commit 8314d14

6 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,8 @@ require('render-markdown').setup({
802802
highlight_title = 'RenderMarkdownLinkTitle',
803803
-- Applies to WikiLink elements.
804804
wiki = {
805+
-- Turn on / off WikiLink rendering.
806+
enabled = true,
805807
icon = '󱗖 ',
806808
body = function()
807809
return nil
@@ -1579,6 +1581,8 @@ require('render-markdown').setup({
15791581
highlight_title = 'RenderMarkdownLinkTitle',
15801582
-- Applies to WikiLink elements.
15811583
wiki = {
1584+
-- Turn on / off WikiLink rendering.
1585+
enabled = true,
15821586
icon = '󱗖 ',
15831587
body = function()
15841588
return nil

doc/render-markdown.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*render-markdown.txt* For NVIM v0.11.5 Last change: 2026 January 16
1+
*render-markdown.txt* For NVIM v0.11.6 Last change: 2026 January 28
22

33
==============================================================================
44
Table of Contents *render-markdown-table-of-contents*
@@ -868,6 +868,8 @@ Default Configuration ~
868868
highlight_title = 'RenderMarkdownLinkTitle',
869869
-- Applies to WikiLink elements.
870870
wiki = {
871+
-- Turn on / off WikiLink rendering.
872+
enabled = true,
871873
icon = '󱗖 ',
872874
body = function()
873875
return nil
@@ -1625,6 +1627,8 @@ Link Configuration ~
16251627
highlight_title = 'RenderMarkdownLinkTitle',
16261628
-- Applies to WikiLink elements.
16271629
wiki = {
1630+
-- Turn on / off WikiLink rendering.
1631+
enabled = true,
16281632
icon = '󱗖 ',
16291633
body = function()
16301634
return nil

lua/render-markdown/health.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local state = require('render-markdown.state')
66
local M = {}
77

88
---@private
9-
M.version = '8.11.1'
9+
M.version = '8.11.2'
1010

1111
function M.check()
1212
M.start('versions')

lua/render-markdown/render/common/wiki.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ end
1919
---@protected
2020
function Render:run()
2121
local config = self.config.wiki
22+
if not config.enabled then
23+
return
24+
end
2225

2326
local _, _, pre, text, post = self.node.text:find('^(.-%[+)(.-)(%]+.-)$')
2427
if not pre or not text or not post then

lua/render-markdown/settings.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,7 @@ M.link = {}
12421242
---@field suffix string
12431243

12441244
---@class (exact) render.md.link.wiki.Config
1245+
---@field enabled boolean
12451246
---@field icon string
12461247
---@field body fun(ctx: render.md.link.Context): render.md.mark.Text|string?
12471248
---@field highlight string
@@ -1291,6 +1292,8 @@ M.link.default = {
12911292
highlight_title = 'RenderMarkdownLinkTitle',
12921293
-- Applies to WikiLink elements.
12931294
wiki = {
1295+
-- Turn on / off WikiLink rendering.
1296+
enabled = true,
12941297
icon = '󱗖 ',
12951298
body = function()
12961299
return nil
@@ -1360,6 +1363,7 @@ function M.link.schema()
13601363
highlight_title = { type = 'string' },
13611364
wiki = {
13621365
record = {
1366+
enabled = { type = 'boolean' },
13631367
icon = { type = 'string' },
13641368
body = { type = 'function' },
13651369
highlight = { type = 'string' },

lua/render-markdown/types.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@
228228
---@field suffix? string
229229

230230
---@class (exact) render.md.link.wiki.UserConfig
231+
---@field enabled? boolean
231232
---@field icon? string
232233
---@field body? fun(ctx: render.md.link.Context): render.md.mark.Text|string?
233234
---@field highlight? string

0 commit comments

Comments
 (0)