Skip to content

Commit c301209

Browse files
feat: support quarto executable code block syntax
## Details For `quarto`, executable code blocks are denoted by surrounding the language name in curly braces. This is not valid `markdown` syntax generally speaking but curly braces are handled by the parser, so this plugin may as well support it as well, at least to some extent. The way the parser is written leading spaces are ignored, and leading curly braces are added to the info string, but not the language. Once the language name ends (single word) any trailing text is also added to the info string. This change updates the logic of computing the info string around the language to get any leading and trailing text, instead of assuming that all text is trailing text. Text is positioned around the language in the same way it would be in the underlying buffer. Info text can still be disabled in the same way as before.
1 parent 3115ff7 commit c301209

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
[ec92f60](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/ec92f60b28be3e63007e62bb4084af5633eaf1d6)
1919
- correctly order indent & padding [#457](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/457)
2020
[0944ba0](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/0944ba04ea7fc9e9087c1dedc76562d6e0d110cf)
21+
- skip nodes with errors [#451](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/451)
22+
[3115ff7](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/3115ff748d6885fe1af349feb6b73de03eda8e12)
2123

2224
### Collaborator Shoutouts
2325

doc/render-markdown.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*render-markdown.txt* For NVIM v0.11.2 Last change: 2025 June 30
1+
*render-markdown.txt* For NVIM v0.11.2 Last change: 2025 July 08
22

33
==============================================================================
44
Table of Contents *render-markdown-table-of-contents*

lua/render-markdown/health.lua

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

77
---@private
8-
M.version = '8.5.12'
8+
M.version = '8.5.13'
99

1010
function M.check()
1111
M.start('version')

lua/render-markdown/render/markdown/code.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ function Render:language(info, language, delim)
131131
text:text(language.text, language_hl)
132132
end
133133
if self.config.language_info then
134-
text:text(info.text:sub(#language.text + 1), info_hl)
134+
local offset = info.start_col
135+
text = self:line()
136+
:text(info.text:sub(1, language.start_col - offset), info_hl)
137+
:extend(text)
138+
:text(info.text:sub(language.end_col - offset + 1), info_hl)
135139
end
136140
if text:empty() then
137141
return false

tests/code_spec.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,11 @@ describe('code', function()
270270
' ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔',
271271
})
272272
end)
273+
274+
it('quarto executable', function()
275+
util.setup.text({ '``` {{rust} info', '```' })
276+
util.assert_screen({
277+
'󱘗 {{󱘗 rust} info████████████████████████████████████████████████████████████████',
278+
})
279+
end)
273280
end)

0 commit comments

Comments
 (0)