-
Notifications
You must be signed in to change notification settings - Fork 526
Open
Description
render = ::Redcarpet::Render::HTML.new(hard_wrap: false)
extensions = {
no_intra_emphasis: true,
tables: true,
autolink: true,
strikethrough: true,
disable_indented_code_blocks: true,
superscript: true,
}
parser = ::Redcarpet::Markdown.new(render, extensions)
Example 1, the URL can be parsed as a <a>
tag, it works.
subject.render("<html>\n\n<div>www.test.com</div></html>")
# => "<p><html></p>\n\n<p><div><a href=\"http://www.test.com\">www.test.com</a></div></html></p>\n"
Example 2, the first URL cannot be parsed as a <a>
tag, only the second URL works.
subject.render("<html>\n\n<div>www.test.com</div>\n\n<div>www.test.com</div></html>")
# => "<p><html></p>\n\n<div>www.test.com</div>\n\n<p><div><a href=\"http://www.test.com\">www.test.com</a></div></html></p>\n"
Example 3, both URLs can be parsed correctly, the difference is there is only one line break in front of the first <div>
.
subject.render("<html>\n<div>www.test.com</div>\n\n<div>www.test.com</div></html>")
# => "<p><html>\n<div><a href=\"http://www.test.com\">www.test.com</a></div></p>\n\n<p><div><a href=\"http://www.test.com\">www.test.com</a></div></html></p>\n"
Metadata
Metadata
Assignees
Labels
No labels