You seem to be generating macro output which is only accidentally valid for htmlgen. If you change your code to this then it works fine: let html = traverseTree: dv(id = "1", h1(style = "value", "hello world"), p("This is a paragraph")) echo html Run
Of course you could generate output like this with your original input, but I'll leave that as an exercise for the reader. P.S.: You really should try to avoid using `repr` when writing macros (apart from getting pretty output for debugging)