Open bkazez opened 3 years ago
Hi @bkazez, not a maintainer but I noticed this issue locally. If you pass the arguments through to the Redcarpet::Markdown
class, you'll see the behavior you're looking for.
# Your Example, passing options into HTML.new
markdown_renderer = Redcarpet::Markdown.new(
Redcarpet::Render::HTML.new(hard_wrap: true),
)
markdown_renderer.render("hello \nworld")
=> "<p>hello<br><br>\nworld</p>\n"
# My Example, passing options as arg to Markdown.new
markdown_renderer = Redcarpet::Markdown.new(
Redcarpet::Render::HTML.new,
hard_wrap: true),
)
markdown_renderer.render("hello \nworld")
=> "<p>hello<br>\nworld</p>\n"
Thanks @dlinch! I tried this and don't get any hard wrapping at all — things like\nthis
aren't translated into like<br>this
.
@bkazez I found a combination of the hard_wrap
and the lax_spacing
options generally worked the way I expected.
Two extra trailing spaces + hard_warp: true => extra
inserted:
=>
"<p>hello<br><br>\nworld</p>\n"
With just one extra trailing space, or with hard_wrap: false, this does not occur.