aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/tohtml.lua
diff options
context:
space:
mode:
authoraltermo <107814000+altermo@users.noreply.github.com>2025-03-10 17:15:41 +0100
committerGitHub <noreply@github.com>2025-03-10 09:15:41 -0700
commit67c39f5ecae0edc3777b2db0f7e637cafa097d05 (patch)
tree687aed2f2d6d9d9848be2b32c0e42a4a48348ac3 /runtime/lua/tohtml.lua
parentc9b5ac113a4103956407165a7ebb2bba0c425e07 (diff)
downloadrneovim-67c39f5ecae0edc3777b2db0f7e637cafa097d05.tar.gz
rneovim-67c39f5ecae0edc3777b2db0f7e637cafa097d05.tar.bz2
rneovim-67c39f5ecae0edc3777b2db0f7e637cafa097d05.zip
fix(tohtml): disable modeline #32822
Problem: Running :TOhtml with a file containing modeline may generate an invalid modeline in the output. Solution: Add `<!-- vim: set nomodeline: -->` to the output. Use vi-compatible modeline format ("set foo:"), to avoid the trailing `-->` being treated as part of the modeline.
Diffstat (limited to 'runtime/lua/tohtml.lua')
-rw-r--r--runtime/lua/tohtml.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua
index 6b8daab2c5..80892f5c60 100644
--- a/runtime/lua/tohtml.lua
+++ b/runtime/lua/tohtml.lua
@@ -1372,6 +1372,7 @@ local function win_to_html(winid, opt)
state_generate_style(state)
local html = {}
+ table.insert(html, '<!-- vim: set nomodeline: -->')
extend_html(html, function()
extend_head(html, global_state)
extend_body(html, function()