diff options
| author | Asko Nõmm <ano@ano.ee> | 2022-05-15 15:14:23 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-15 15:14:23 +0300 |
| commit | 15427708e17b89ad3d3da0d5f297d3292633b4b7 (patch) | |
| tree | 539a29c3e74e1028cea04304e0c473e5e038ae4e /src/clarktown/core.clj | |
| parent | 2ff0da12f58d17b6c1ab3736a41595073b3a534e (diff) | |
| parent | df9888269fd4f68d0d6105233332b25a3c79b226 (diff) | |
Merge pull request #33 from askonomm/32-overwrite-parsers-and-correctors-via-a-config-map-instead
Use a config map instead to overwrite parsers and correctors.
Diffstat (limited to 'src/clarktown/core.clj')
| -rw-r--r-- | src/clarktown/core.clj | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/clarktown/core.clj b/src/clarktown/core.clj index 2a3e3a1..2e13470 100644 --- a/src/clarktown/core.clj +++ b/src/clarktown/core.clj @@ -7,24 +7,11 @@ (defn render "Renders the given `markdown` into a consumable HTML form. Optionally, - a second argument can be passed that is made out of a vector of parsers. - - A parser is a map that consists of two things; - - A matcher (optional) , which returns a truthy or falsey value - - Renderers, which will be run on the a block when matcher returns true. - There can be any number of renderers. Each renderer must return a string. - - Each matcher, and each renderer have to be a function that take a single - argument, which is a given Markdown block. - - An example parser: - ```clojure - {:matcher (fn [block] ...) - :renderers [(fn [block] ...) (fn [block] ...)]} - ```" + a second argument can be passed to overwrite default parsers and + correctors.`" ([markdown] - (render markdown parsers/default-parsers)) - ([markdown given-parsers] - (render markdown given-parsers correctors/default-correctors)) - ([markdown given-parsers given-correctors] - (engine/render markdown given-parsers given-correctors))) + (render markdown {})) + ([markdown {:keys [parsers correctors] :or + {parsers parsers/default-parsers + correctors correctors/default-correctors}}] + (engine/render markdown parsers correctors))) |
