This is similar to #205 but less common. Consider the following code:
(ns example
(:require [clojure.walk :as walk]
[hiccup2.core :as h]))
(walk/macroexpand-all
`(h/html
[:p (identity "") "foo"]
(identity (h/html
[:p (identity "") "bar"]
(identity (h/html
[:p (identity "") "gazonk"]
In the generated code, foo will appear 8 times, bar 64 times, and gazonk 512 times.
If you try to evaluate this code normally (i.e. without macroexpand-all), it will throw "IndexOutOfBoundsException: Method code too large!"
Each level of nesting multiplies the code by 8, because every h/html checks hiccup.util/*html-mode* and hiccup.util/*escape-strings?* again and generates the 8 code paths.
Is there a way for a Clojure macro to recognize that it's nested within itself? Then those 8 code paths could be generated at only the outermost h/html, and the inner macros could use the same html and escape mode as the outermost macro.
Hiccup version 2.0.0-RC3
Workaround
Extract the inner html macro call to a function, so that you won't have many nested html macros.