From a2f6076856b9d71f2ea326cc7f9a930258583152 Mon Sep 17 00:00:00 2001 From: Noah Moss <32746338+noahmoss@users.noreply.github.com> Date: Thu, 3 Feb 2022 09:37:30 -0500 Subject: [PATCH] Fix display of horizontal lines in dashboard text cards (#20177) --- frontend/src/metabase/visualizations/visualizations/Text.css | 4 ++++ src/metabase/pulse/markdown.clj | 5 ++++- test/metabase/pulse/markdown_test.clj | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/src/metabase/visualizations/visualizations/Text.css b/frontend/src/metabase/visualizations/visualizations/Text.css index 132bffb07f7..938a0a61bfb 100644 --- a/frontend/src/metabase/visualizations/visualizations/Text.css +++ b/frontend/src/metabase/visualizations/visualizations/Text.css @@ -155,6 +155,10 @@ height: auto; } +:local .text-card-markdown hr { + margin: 0; +} + :local .single-row { margin: 0; } diff --git a/src/metabase/pulse/markdown.clj b/src/metabase/pulse/markdown.clj index 4df6a160e7d..b4dad9eb60b 100644 --- a/src/metabase/pulse/markdown.clj +++ b/src/metabase/pulse/markdown.clj @@ -228,7 +228,10 @@ :hard-line-break "\n" - (:heading) + :horizontal-line + "\n───────────────────\n" + + :heading (str "*" joined-content "*\n") :bold diff --git a/test/metabase/pulse/markdown_test.clj b/test/metabase/pulse/markdown_test.clj index 2a3920bc952..4463e39a652 100644 --- a/test/metabase/pulse/markdown_test.clj +++ b/test/metabase/pulse/markdown_test.clj @@ -40,6 +40,10 @@ (is (= "foo\nbar" (mrkdwn "foo \nbar"))) (is (= "foo\nbar" (mrkdwn "foo\\\nbar")))) + (testing "Horizontal lines are created using box drawing characters" + (is (= "───────────────────" (mrkdwn "----"))) + (is (= "text\n\n───────────────────\ntext" (mrkdwn "text\n\n----\ntext")))) + (testing "Code blocks are preserved" (is (= "`code`" (mrkdwn "`code`"))) (is (= "```\ncode\nblock```" (mrkdwn " code\n block"))) -- GitLab