Skip to content

Cannot make soft_break work #653

Answered by colinodell
pherrymason asked this question in Q&A
Discussion options

You must be logged in to vote

Per the CommonMark spec, soft breaks do not render as <br> tags by default.

This library does have a configuration option you can change to '<br>' to get that functionality: https://commonmark.thephpleague.com/configuration/

Try making using this instead:

$converter = new CommonMarkConverter([
    'renderer' => [
        'soft_break' => '<br>',
    ]
]);
return $converter->convertToHtml($html);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by colinodell
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question General questions about the project or usage spec compliance Issues or question about compliance with the CommonMark or GFM specs
2 participants
Converted from issue

This discussion was converted from issue #311 on June 12, 2021 14:04.