function replaceSnippetIDs(text, idmap) return text:gsub("(#%d+)", function(id) return idmap[id] or id end) end