pandoc-lua-filters/misc/remove-leading-softbreaks-footnotes.lua

17 lines
469 B
Lua
Raw Permalink Normal View History

--[[
When a long footnote is inserted like this^[
Here is my footnote.
It spans several lines!
], Pandoc retains the initial line break in the AST,
causing the insertion of a space
at the beginning of the footnote in the output.
This filter removes any line break
at the beginning of a footnote.
]]--
function Note(note)
local content = note.content[1].content
if content[1].t == 'SoftBreak' then table.remove(content, 1) end
return note
end