From 38d68c312c345786e3ca8e8e4634a234d4b7f12b Mon Sep 17 00:00:00 2001 From: "dmitri.sotnikov@gmail.com" Date: Thu, 10 Jan 2019 19:14:15 -0500 Subject: [PATCH] fixed inline code formatting, issue 146 --- project.clj | 2 +- src/cljc/markdown/common.cljc | 6 +++++- test/markdown/md_test.cljc | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/project.clj b/project.clj index 8ec9f8d..082b61d 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject markdown-clj "1.0.5" +(defproject markdown-clj "1.0.6" :description "Markdown parser" :url "https://github.com/yogthos/markdown-clj" :license {:name "Eclipse Public License" diff --git a/src/cljc/markdown/common.cljc b/src/cljc/markdown/common.cljc index 7f29736..d8b43d2 100644 --- a/src/cljc/markdown/common.cljc +++ b/src/cljc/markdown/common.cljc @@ -181,5 +181,9 @@ text (-> text (string/replace #"\-\-\-" "—") - (string/replace #"\-\-" "–"))) + (string/replace #"\-\-" "–") + (string/replace #".*" + (fn [s](-> s + (string/replace #"—" "---") + (string/replace #"–" "--")))))) state]) diff --git a/test/markdown/md_test.cljc b/test/markdown/md_test.cljc index 60cab94..cbd3a75 100644 --- a/test/markdown/md_test.cljc +++ b/test/markdown/md_test.cljc @@ -158,6 +158,8 @@ (deftest code (is (= "

foo bar baz x = y + z; foo

" (entry-function "foo bar baz `x = y + z;` foo"))) + (is (= "

bar foo --- -- bar foo

" + (entry-function "bar `foo --- -- bar` foo"))) (is (= "

<?xml version='1.0' encoding='UTF-8'?><channel></channel>

" (entry-function "``"))) (is (= "

foo bar baz (fn [x & xs] (str "x:" x)) foo

"