         inline-string (.replace source-string re-nl (pref :new-line-string-replacer))
         max-inline-string-size (+ (pref :string-prefix-limit) (pref :string-postfix-limit))]
     (if (<= (count inline-string) max-inline-string-size)
-      (template (pref :span) (pref :string-style) (str dq inline-string dq))
-      (let [abbreviated-string-template (template (pref :span) (pref :string-style) (str dq (abbreviate-long-string inline-string) dq))
+      (template :span :string-style (str dq inline-string dq))
+      (let [abbreviated-string-template (template :span :string-style (str dq (abbreviate-long-string inline-string) dq))
             string-with-nl-markers (.replace source-string re-nl (str (pref :new-line-string-replacer) "\n"))
-            body-template (template (pref :ol) (pref :standard-ol-style)
-                            (template (pref :li) (pref :standard-li-style)
-                              (template (pref :span) (pref :string-style) (str dq string-with-nl-markers dq))))]
+            body-template (template :ol :standard-ol-style
+                            (template :li :standard-li-style
+                              (template :span :string-style (str dq string-with-nl-markers dq))))]
         (reference (surrogate source-string abbreviated-string-template true body-template))))))
 
 (defn bool? [value]

      (.merge writer (wrap-group-in-reference-if-needed inner-tmpl obj) obj))))

(defn managed-pr-str [value style print-level]
  (let [tmpl (template (pref :span) style)
        writer (TemplateWriter. tmpl)]
    (binding [*print-level* print-level]                    ; when printing do at most print-level deep recursion
      (pr-seq-writer [value] writer {:alt-impl     alt-printer-impl

    (aget config "prevent-recursion")))

(defn template [tag style & children]
  (let [resolve-pref (fn [pref-or-val] (if (keyword? pref-or-val) (pref pref-or-val) pref-or-val))
        tag (resolve-pref tag)
        style (resolve-pref style)
        js-array #js [tag (if (empty? style) #js {} #js {"style" style})]]
    (doseq [child children]
      (if (coll? child)
        (.apply (aget js-array "push") js-array (into-array child)) ; convenience helper to splat cljs collections
        (.push js-array (resolve-pref child))))
    js-array))

(defn reference
