diff --git a/src/cljc/markdown/transformers.cljc b/src/cljc/markdown/transformers.cljc index c3820fd..b50300f 100644 --- a/src/cljc/markdown/transformers.cljc +++ b/src/cljc/markdown/transformers.cljc @@ -162,7 +162,7 @@ (defn paragraph [text state] (apply close-paragraph (open-paragraph text state))) -(defn code [text {:keys [eof lists code codeblock] :as state}] +(defn code [text {:keys [eof lists code codeblock paragraph] :as state}] (cond (or lists codeblock) [text state] @@ -172,6 +172,9 @@ [(str "" text) (dissoc state :indented-code :code :last-line-empty?)] [(str "\n" (escape-code (string/replace-first text #" " ""))) state]) + paragraph + [text state] + (empty? (string/trim text)) [text state] diff --git a/test/markdown/md_test.cljc b/test/markdown/md_test.cljc index 88caa71..29fb56f 100644 --- a/test/markdown/md_test.cljc +++ b/test/markdown/md_test.cljc @@ -193,6 +193,18 @@ ``` ")))) +(deftest indented-codeblock + (is (= "
foo
"
+ (entry-function " foo")))
+ (is (= "foo
bar
" + (entry-function " foo\n\nbar"))) + (is (= "foo
bar"
+ (entry-function " foo\nbar")))
+ (is (= "baz foo
bar
" + (entry-function "baz\n foo\n\nbar"))) + (is (= "Element #1
Element #1
\nfoo