Skip to content

Commit

Permalink
fix(export): handle empty object/array nodes in markdown metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ALVAROPING1 authored and vhyrro committed Dec 27, 2023
1 parent d56cc3c commit 3afbadb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lua/neorg/modules/core/export/markdown/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,10 @@ local function handle_heading_newlines()
end
end

local function handle_metadata_composite_element()
local function handle_metadata_composite_element(empty_element)
return function(output, state, node)
if vim.tbl_isempty(output) then
-- TODO: Handle empty value
return { "\n" }
return { get_metadata_array_prefix(node, state), empty_element, "\n" }
end
local parent = node:parent():type()
if parent == "array" then
Expand Down Expand Up @@ -660,8 +659,8 @@ module.public = {
["heading5"] = handle_heading_newlines(),
["heading6"] = handle_heading_newlines(),

["object"] = handle_metadata_composite_element(),
["array"] = handle_metadata_composite_element(),
["object"] = handle_metadata_composite_element("{}"),
["array"] = handle_metadata_composite_element("[]"),
},

cleanup = function()
Expand Down

0 comments on commit 3afbadb

Please sign in to comment.