                                      (identical? (first %) :li))
                                (:value input))])
           (rf res input)))))))
+
+(def ^:private text-value
+  (rexf/stateless-xf
+   (fn [rf]
+     (fn
+       ([] (rf))
+       ([res] (rf res))
+       ([res input]
+        (cond (identical? :text (:type input)) (rf res (:value input))
+              (identical? :para-end (:type input)) res
+              :else (rf res input)))))))
+
+(defn paragraphiphy
+  [rf]
+  (reify ReducerFactory
+    (init [_]
+      (let [rf' (rexf/init rf)
+            reinit-rf (text-value rf)]
+        (reify clojure.lang.IFn
+          (invoke [_] (rf'))
+          (invoke [_ res] (rf' res))
+          (invoke [_ res input]
+            (cond (identical? :text (:type input)) (rf res [:p (:value input)])
+                  (identical? :para-end (:type input)) res
+                  :else (rf res input)))
+          Reducer
+          (reinit [_] (rexf/init reinit-rf)))))))

(def sub    (vectorize-invoke "\\textsubscript" :sub))
(def sup    (vectorize-invoke "\\textsuperscript" :sup))

(def common-invokes
  (comp h1 h2 h3 h4 strong em sub sup))


    (vreset! subrf ::none)
    val))

(defn none? [val] ;; todo: inline
  (identical? ::none val))

(def item-to-li
