         (heading-level text)
         (let [h (heading-level text)
               t (heading-text text)
-              l (sanitize t)]
-          ;; NOTE Clickable section headers.
+              ;; NOTE Not to expand potential formatting in the label.
+              [l s] (freeze-string (sanitize t) state)]
           [(str "<h" h ">"
                 (if heading-anchors
                   (str "<a name=\"" l "\"></a>"

          [text state]
          (re-seq subs-regex text)))

(defn- heading-transformer [text {:keys [code codeblock heading-anchors heading-links] :as state}]
  (cond (or code codeblock)
        [text state]

                         t))
                  t)
                "</h" h ">")
           (assoc s :heading true)])

        :else
        [text state]))
