Skip to content

Commit

Permalink
Add support for root level br.
Browse files Browse the repository at this point in the history
  • Loading branch information
francois2metz committed Oct 4, 2021
1 parent aca6ff0 commit dbde966
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/kramdown/converter/prismic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def convert_blockquote(element)
end

def convert_hr(element); end
def convert_br(element); end

def convert_img(element)
{
Expand Down
14 changes: 14 additions & 0 deletions test/converter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,20 @@ def test_convert_br
assert_equal expected, Kramdown::Document.new(html, input: :html).to_prismic
end

def test_convert_br_in_root_element
expected = [
{
type: 'paragraph',
content: {
text: "Test\n",
spans: []
}
}
]
html = '<br><p>Test<br></p>'
assert_equal expected, Kramdown::Document.new(html, input: :html).to_prismic
end

def test_convert_html_with_no_tags
expected = [
{
Expand Down

0 comments on commit dbde966

Please sign in to comment.