This filter will remove all empty Spans with id starting with x. Save as "removeXSpans.lua': function Span(el) return #el.content == 0 and el.identifier:match('^x%d') and pandoc.Space() or el end And run pandoc with the `-L removeXSpans.lua` option, e.g. pandoc -f dockbook sourcefile -t markdown -o outfile.md -L removeXSpans.lua Result: # 1 Introduction However, this will break any link to #x1-10001. If there are internal links in the doc (e.g. from the table of content) that you need to preserve, you need a filter that produces instead: # 1 Introduction {#x1-10001} Perhaps this will work (it'd help to have a sample docbook source), saved as removeXSpans.lua and used as above function Header(hd) local id = '' hd.content = hd.content:walk { Span = function(el) if #el.content == 0 and el.identifier:match('^x%d') then id = el.identifier return pandoc.Space() end end } print(id) if id ~= '' then hd.identifier = id return hd end end On Wednesday, April 5, 2023 at 11:38:07 PM UTC+1 hcf wrote: > I'm converting from DocBook to Markdown. > > In DocBook there are xml:id tags. When I convert to markdown these are > rendered as > > []{#x1-10001}. > > > A markdown heading look like this when converting from DocBook. > > > # 1[]{#x1-10001}Introduction > > > Is there a way to turn this off? > > > best regards > > hcf > -- 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/115179cd-21e7-4e29-aea0-add708149ce0n%40googlegroups.com.