Skip to content

Commit a2a3ef8

Browse files
committed
feat(babel): add shebang support for tangled code blocks
Add the ability to include a shebang line at the beginning of tangled code files by supporting the `:shebang` header argument. The shebang value is cleaned of quotes and inserted as the first line of the tangled content.
1 parent 556578d commit a2a3ef8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/orgmode/babel/tangle.lua

+7
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ function Tangle:tangle()
8080
vim.fn.mkdir(path, 'p')
8181
end
8282

83+
local shebang = info.header_args[':shebang']
84+
if shebang then
85+
shebang = shebang:gsub('[\'"]', '')
86+
utils.echo_info(('shebang: %s'):format(shebang))
87+
table.insert(parsed_content, 1, shebang)
88+
end
89+
8390
if info.name then
8491
block_content_by_name[info.name] = parsed_content
8592
end

0 commit comments

Comments
 (0)