How to convert a string variable with html tags in a html document?

Dear Sirs programmers!
Question essence in the following:
There is a variable $content of the form:
# This is a string \n\n\n\nPresent to you is the first

As you can see here for markdown formatting is used, the output I want to get processed correctly text but get get completely taken the text in the h1 tag, i.e. when processing markdown does not consider \n to the end of the row.

Tried to replace br with \n, doesn't help.
Treated with markdown like this:
$show = Markdown::convert($show);

However, if I put in the database of enter to wrap to a new line, the processing is correct.

What do I need to replace \n to the text is rendered correctly?
Can first somehow send the html to the output, pick it up, and then dobranotch a markdown? But it looks kind of.. Wrong.) Could you tell me?
July 2nd 19 at 17:21
2 answers
July 2nd 19 at 17:23
July 2nd 19 at 17:25
Yes, I'm using this module. The point is that I don't have closing tags
$content = '### Heading 3 ###'

Tags and line breaks markdown does not recognize in itself. Thus, if the text variable (text in database), put enter, the markdown works fine.

Find more questions by tags YiiHTMLPHP