From b81e05a97ffc70959139917109887c79e3601a7c Mon Sep 17 00:00:00 2001 From: Eric Squires Date: Thu, 23 May 2024 12:01:14 -0400 Subject: [PATCH] feat(export.markdown) add footnote support (#1383) --- lua/neorg/modules/core/export/markdown/module.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/neorg/modules/core/export/markdown/module.lua b/lua/neorg/modules/core/export/markdown/module.lua index 48b154eed..366de85f6 100644 --- a/lua/neorg/modules/core/export/markdown/module.lua +++ b/lua/neorg/modules/core/export/markdown/module.lua @@ -224,10 +224,23 @@ module.public = { tag_close = nil, ranged_tag_indentation_level = 0, is_url = false, + footnote_count = 0, } end, functions = { + + ["single_footnote"] = function(_, node, state) + state['footnote_count'] = state['footnote_count'] + 1 + for nd in node:iter_children() do + if nd:type() == 'paragraph' then + local n = state['footnote_count'] + return "[^" .. n .. "]\n\n\n[^" .. n .. "]: " .. module.required["core.integrations.treesitter"].get_node_text(nd) + end + end + return "" + end, + ["_word"] = true, ["_space"] = true,