Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6115685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:07:12+00:00 2026-05-23T15:07:12+00:00

I have WMD editor on my site, and i store the markdown in the

  • 0

I have WMD editor on my site, and i store the markdown in the DB. But before i send the markdown to database i filter it with mysql_real_escape_string, like that:

$to_database = mysql_real_escape_string($_POST['markdown']);

And it’s okay. But now I want to show it, so i use PHP Markdown (which converts markdown to html). But the problem is that it shows me \r\n and \n instead of new lines. I tried nl2br function, but it didn’t help. Even if I do not escape the output (do not convert markdown to html and using htmlpurifier) I still get \n instead of new lines.
Only when I remove mysql_real_escape_string it looks fine.

bbbbbbbbbbb
nnnnnnnnn

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:07:12+00:00Added an answer on May 23, 2026 at 3:07 pm

    They are being converted and are no longer acting as line breaks. You want to replace them:

    $markdown = str_replace('\r\n','<br/>',$_POST['markdown']);
    $markdown = str_replace('\n','<br/>',$markdown);
    

    You might also want to do this:

    $markdown = html_entity_decode($markdown);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If any of you have ever used wmd markdown editor (which is like the
I quite like that WMD is behaving nicely with my app. However, I have
the result i want is a textarea that hooks up to WMD (markdown editor).
i m using wmd markdown editor in my project and i have a problem
I am looking for something very simlar to the SO WMD markdown editor that
I am currently trying to add the WMD editor to my site. I have
I added WMD Editor as Stackoverflow does, but I have in my css, *
I'm trying to use derobins wmd editor, with ASP.NET MVC 3 Project. I have
I have just implemented WMD for my editor in an ASP.NET app. The problem
I am using the WMD markdown editor in a project for a large number

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.