Support » Themes and Templates » Convert single line break to paragraph

  • Resolved jesusmechicoteia


    Hi all.
    I’ve been trying this for some time, first with Movable Type and now with WordPress. All that I want is to have an extra line between blocks of text. Since I started blogging, I used to finish a paragraph hitting ENTER and starting a new one. As I’m going to do now.
    See? What I wnat is a blank line before this one I’m writing right now.
    Why do I need that? Well, check this post for instance. It’s in Portuguese, maybe you can’t read it, but this is not the point. Notice how paragraphs are all jammed together. I’d like to hit ENTER and see that extra line on my weblog. I tried this using CSS, by adding this:

    post-content br {
                       margin-bottom: 12px;

    But it adds a blank line BEFORE the line with the < br/ > tag. margin-top is no good either.
    Could someone help me with this? Thanks a lot.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello

    This is one paragraph.

    This is another paragraph.

    If I just hit enter once,
    it creates a line break. If I hit enter 2 times…

    …it makes a new paragraph. 🙂

    See the source:
    <p>This is one paragraph.</p>
    <p>This is another paragraph.</p>
    <p>If I just hit enter once,<br>
    it creates a line break. If I hit enter 2 times...</p>
    <p> makes a new paragraph. :)</p>

    Hope it helps. 🙂

    Thanks for your answer.
    Yes, I guess I could start doing it. But what about my 4.500 or so earlier posts? I’d like to see all of them formatted like this, with the <br/> tag behaving like <p>.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    If you go look at the post in the database, you’ll notice that it doesn’t have br or p tags, just your single ENTER keypresses. If you change those to double enter’s, then WordPress will render those as the paragraph tags.

    So, what about all your other posts? Edit them to have double enters. You might be able to do this in the database directly all at once, but that is full of problems, so the best way is probably just to do it by hand.

    If you use the visual editor, what you see is what you get, for the most part. So if it shows the lines jammed together, then they will get jammed together. However, when using the visual editor, a single ENTER keypress actually inserts a paragraph break (two enter’s). You only have to hit enter twice if you use the Code tab to edit your posts with.

    Thank you, Otto.
    I’m using the visual editor right now, and it does exactly what I want. It’s a pitty that Movable Type wasn’t able to do something like that.
    About changing the posts: I’d do it by hand, but it would take me forever. I think I’ll try to make a backup of the entries table, do the replace and see what happens. If it’s something awful, I just restore the backup.
    Thank you very much.

    Hmmmm, no can do. How does MySQL store the line breaks?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    When I look at an SQL dump of my posts table (using phpMyAdmin), I see \r\n everywhere I put in a line break. And \r\n\r\n for the paragraph break.

    I see. I’ll give that a try (fingers crossed).
    Thanks a lot, Otto.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Convert single line break to paragraph’ is closed to new replies.