diff options
| author | Asko Nõmm <ano@ano.ee> | 2022-05-11 20:42:30 +0300 |
|---|---|---|
| committer | Asko Nõmm <ano@ano.ee> | 2022-05-11 20:42:30 +0300 |
| commit | 7c3eba77fd3de0e108efba94018233a57e66989e (patch) | |
| tree | ae7e3c28a7b097d9dffd60a005c96fdb9758f039 /src/clarktown/renderers/indented_code_block.clj | |
| parent | 94c1c0ca639f55ff9073cb1fdf2ad6015bb6bae1 (diff) | |
Implement indented code blocks.
Diffstat (limited to 'src/clarktown/renderers/indented_code_block.clj')
| -rw-r--r-- | src/clarktown/renderers/indented_code_block.clj | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/clarktown/renderers/indented_code_block.clj b/src/clarktown/renderers/indented_code_block.clj new file mode 100644 index 0000000..b3828ec --- /dev/null +++ b/src/clarktown/renderers/indented_code_block.clj @@ -0,0 +1,17 @@ +(ns clarktown.renderers.indented-code-block + (:require + [clojure.string :as string])) + + +(defn render + "Renders the indented code block." + [block _ _] + (str + "<pre><code>" + (-> (->> (string/split-lines block) + (map #(subs % 4)) + (string/join \newline)) + (string/replace #"&" "&") + (string/replace #"<" "<") + (string/replace #">" ">")) + "</code></pre>"))
\ No newline at end of file |
