WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Convert single line break to paragraph (8 posts)

  1. jesusmechicoteia
    Member
    Posted 7 years ago #

    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.

  2. BPartch
    Member
    Posted 7 years ago #

    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>...it makes a new paragraph. :)</p>

    Hope it helps. :)

  3. jesusmechicoteia
    Member
    Posted 7 years ago #

    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>.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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.

  5. jesusmechicoteia
    Member
    Posted 7 years ago #

    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.

  6. jesusmechicoteia
    Member
    Posted 7 years ago #

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

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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.

  8. jesusmechicoteia
    Member
    Posted 7 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic