function Link(link) local target = link.target if string.sub(target, 1, 1) == '#' then local label = string.sub(target, 2) local ref_by_page = pandoc.RawInline('latex', 'page \\#\\pageref{' .. label .. '}') local note_content = pandoc.Para({pandoc.Str('See on '), ref_by_page, pandoc.Str('.')}) local footnote = pandoc.Note(note_content) link.content:insert(footnote) return link.content end end function Span(span) local id = span.identifier if span.identifier then return { pandoc.RawInline('latex', '\\label{' .. id .. '}'), span } end end