Closed whitecoop closed 7 years ago
The parser is stateful, and the order of transformers is state dependent. So, if escape-html
is called before the list transformer runs, it could end up being in a bad state.
Is there a way to guarantee that escape-html
runs before anything else?
You could just preprocess the text before passing it to md->html
:
(defn escape-html [text state]
(clojure.string/escape text
{\& "&"
\< "<"
\> ">"
\" """
\' "'"}))
(-> "* item\n\n***" escape-html md->html)
I should probably update the example in the readme to something else though, since this doesn't work as a transformer.
👍 ok, thanks
Using the
escape-html
function from the README, for some reason the first horizontal rule after a list gets mangled in the output:vs
At first I thought that it may have to do with
cons
ingescape-html
to the front of thetransformer-vector
, but I found that the second one isn't mangled.