You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I faced with some unexpected behaviors when setting render options (v1.1.5).
For example, by default \n will be rendered to <br> (hardbreaks), but when I set any other options to render, hardbreaks will also be disabled.
# hardbreas works, the `\n` in between is renderedCommonmarker.to_html("aaaa\nbbbb")# => "<p>aaaa<br />\nbbbb</p>\n"# hardbreaks does not work!Commonmarker.to_html("aaaa\nbbbb",options: {render: {unsafe: false}})# => "<p>aaaa\nbbbb</p>\n"
The same also happens for extention:
# autolink works by defaultCommonmarker.to_html("### h3")# => "<h3><a href=\"#h3\" aria-hidden=\"true\" class=\"anchor\" id=\"h3\"></a>h3</h3>\n"# autolink is gone!?Commonmarker.to_html("### h3",options: {extension: {footnotes: false}})# => "<h3>h3</h3>\n"
Looking into the ruby code, I'm confused with how the default is handled.
I feel like this is a bug, but all the tests are based on this behavior, so maybe this is intended? To be honest it seems counterintuitive. What do you think?
I open a PR #315 to keep the current behavior by default and add an option to merge the default options for convenience.
The text was updated successfully, but these errors were encountered:
Hi there!
Recently I faced with some unexpected behaviors when setting render options (v1.1.5).
For example, by default
\n
will be rendered to<br>
(hardbreaks), but when I set any other options torender
, hardbreaks will also be disabled.The same also happens for
extention
:Looking into the ruby code, I'm confused with how the default is handled.
I feel like this is a bug, but all the tests are based on this behavior, so maybe this is intended? To be honest it seems counterintuitive. What do you think?
I open a PR #315 to keep the current behavior by default and add an option to merge the default options for convenience.
The text was updated successfully, but these errors were encountered: