         [:h3 (h (exception-message exception))]
         ]
        ]
-      (write-exception-stack exception)
+      (exception->markup exception)
 
       [:h3 "Request"]
 

(defn- element->clojure-name [element]
  (let [names (:names element)]
    (list
      (s/join "/" (butlast names))
      "/"
      [:strong (last names)])))

(defn- element->java-name [element]
  (let [class-name (:class element)
        dotx (.lastIndexOf class-name ".")]
    (list
      (if (pos? dotx)
        (list
          ;; Take up to and including the "dot"
          [:span.package-name (.substring class-name 0 (inc dotx))]
          (.substring class-name (inc dotx)))
        class-name)
      " &mdash; "
      (:method element))))

(defn- stack-trace-element->row-markup
  [element]
  (let [clojure? (-> element :names empty? not)
        class-name (:class element)
        java-name (element->java-name element)
        ^String line (:line element)]
    [:tr
     [:td.function-name
      (if clojure?

      (-> exception .getClass .getName)))

(defprotocol MarkupGeneration
  "Used to convert arbitrary values into markup strings.

  Extended onto nil, String, APersistentMap, Sequential and Object."
  (to-markup
    [value]
    "Returns HTML markup representing the value."))
