Hi, I am trying to make a Lua filter that will replace the normal link text in internal links with section numbers. I want to use internal links in my markdown document like this: See the [Quick introduction]. So, the links are given by the full title of the respective section they refer to. I found a recipe at stackoverflow (https://stackoverflow.com/questions/54128461/how-to-use-latex-section-numbers-in-pandoc-cross-reference) which does this if the link is given like this: See the [](#quick-introduction) This is the Lua code: local make_sections = (require 'pandoc.utils').make_sections local section_numbers = {} function populate_section_numbers (doc) function populate (elements) for _, el in pairs(elements) do if el.t == 'Div' and el.attributes.number then section_numbers['#' .. el.attr.identifier] = el.attributes.number populate(el.content) end end end populate(make_sections(true, nil, doc.blocks)) end function resolve_section_ref (link) if #link.content > 0 or link.target:sub(1, 1) ~= '#' then return nil end local section_number = pandoc.Str(section_numbers[link.target]) return pandoc.Link({section_number}, link.target, link.title, link.attr) end return { {Pandoc = populate_section_numbers}, {Link = resolve_section_ref} } While I do understand what it does, I cannot find out how to change it to my case. How can I retrieve the part written in [] instead of the attributes when scanning the document for those internal links? Or is the not even possible? Any idea is appreciated. Torsten -- 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/186dfc25-8ebd-43ef-8a5b-0fae22106712n%40googlegroups.com.