diff --git a/lua/jupytext/init.lua b/lua/jupytext/init.lua index 81391f2..000e2bc 100644 --- a/lua/jupytext/init.lua +++ b/lua/jupytext/init.lua @@ -93,6 +93,12 @@ local read_from_ipynb = function(ipynb_filename) -- doesn't delete the first line of the actual input table.insert(jupytext_content, 1, "") + -- This allows opening files that have the null character + -- in them (`\0`, the character represented by ASCII 0) + for i,v in ipairs(jupytext_content) do + jupytext_content[i] = v:gsub("\n", "\0") + end + -- Replace the buffer content with the jupytext content vim.api.nvim_buf_set_lines(0, 0, -1, false, jupytext_content) else