From e5279dacde1f53db0d94a1bca2ab4ff45ed5ceec Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 7 Aug 2024 06:09:38 +0300 Subject: [PATCH] Detect

as richtext paragraph --- lib/rich_text.rb | 2 +- test/lib/rich_text_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rich_text.rb b/lib/rich_text.rb index b720f33e7..b0b83cf5a 100644 --- a/lib/rich_text.rb +++ b/lib/rich_text.rb @@ -158,7 +158,7 @@ module RichText end def paragraph?(element) - element.type == :p + element.type == :p || (element.type == :html_element && element.value == "p") end end diff --git a/test/lib/rich_text_test.rb b/test/lib/rich_text_test.rb index 3536db398..929abf823 100644 --- a/test/lib/rich_text_test.rb +++ b/test/lib/rich_text_test.rb @@ -350,6 +350,11 @@ class RichTextTest < ActiveSupport::TestCase assert_equal "Something important here.", r.description end + def test_markdown_html_description + r = RichText.new("markdown", "

Can use HTML tags.

") + assert_equal "Can use HTML tags.", r.description + end + private def assert_html(richtext, &block) -- 2.39.5