Detect <p> as richtext paragraph

This commit is contained in:
Anton Khorev 2024-08-07 06:09:38 +03:00
parent aa8dd75e5e
commit e5279dacde
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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", "<p>Can use HTML tags.</p>")
assert_equal "Can use HTML tags.", r.description
end
private
def assert_html(richtext, &block)