This seems possibly tricky? I don't know what the Lua filters can or cannot do, but I'm not sure how one could solve this using just the Haskell API... Pandoc was not designed as a source-2-source processor so it doesn't make much effort to support Markdown-to-Markdown passes - like the obvious roundtrip will potentially change your Markdown formatting to a semantically-equivalent but entirely different-looking Markdown doc. (Macfarlane has said repeatedly that this will not be changed.) In your case, footnotes throw away the positioning information. Consider the 3 possibilities: Foo[^foo]. Foo bar^[Bar.] Foo baz[^baz] [^baz]: Baz. [^foo]: foo. This parses into: [ Para [ Str "Foo" , Note [ Para [ Str "foo." ] ] , Str "." ] , Para [ Str "Foo" , Space , Str "bar" , Note [ Para [ Str "Bar." ] ] ] , Para [ Str "Foo" , Space , Str "baz" , Note [ Para [ Str "Baz." ] ] ] ] So you can't know 'where' a footnote body was put, whether at the end of the doc or elsewhere. Further, Pandoc will write out the Markdown according to its own conventions, which go opposite of what you want, by putting *all* footnote bodies at the end, regardless of where they were or whether they could be inline footnotes, and the Markdown writer probably takes no options which would change that: Foo[^1]. Foo bar[^2] Foo baz[^3] [^1]: foo. [^2]: Bar. [^3]: Baz. -- gwern https://gwern.net -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAMwO0gw1W6_CHiCr8RGfDkLjt-dTg4y9dPkbU2UouZt%3D1Lj3Cg%40mail.gmail.com.