Skip to content

Commit

Permalink
Added docs for usage with templates
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranshila committed Sep 11, 2021
1 parent 4de690a commit 04be66f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion doc/03-Templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,20 @@ In the latter, you might want to blacklist some tags and only process text in
certain places, this can easily be accomplished with:

```clojure

(defn process-template [mdast template-vals]
(clojure.walk/prewalk
(fn [item]
(if (cybermonday.utils/hiccup? item)
(let [[tag attrs & body] item]
(if (not= tag :code)
(cybermonday.utils/make-hiccup-node
tag
attrs
(map #(if (string? %)
(pogonos.core/render-string % template-vals)
%)
body))
item))
item))
mdast))
```

0 comments on commit 04be66f

Please sign in to comment.