You can, but as soon as you start nesting code in a query you fall into the HTML replacement rabbit hole. Basically, the parser will be looking for those } | , characters once the query starts, and will break as soon as it hits one. More info here . Also a Google sheet for doing replacement for you here , which I've never used but it probably still works! Another example here , an iterative attack for Pathfinder that uses HTML replacement to output another template section. You're generally better off avoiding this if you can, and using Chat Menus - see Keith's rundown for instructions. If you're super keen on going ahead with the nesting... good luck! It's totally achievable, but you want to be pretty confident before you start - the more complex your code is, the harder it will be to find that pesky comma breaking your mega-macro.