WordPress.org

Forums

Markdown (11 posts)

  1. marmelade
    Member
    Posted 10 years ago #

    I've tried to search around for answers, but couldn't find any. I'd like the formatting on entries to be <br>. I thought the markdown plugin would do that, but I guess I was wrong. Or is it simply that it doesn't effect old entries? Someone please help.

  2. chuyskywalker
    Member
    Posted 10 years ago #

    I'd like the formatting on entries to be < br >

    Do you mean that you don't want any < p > tags added?

    Markdown will produce valid HTML code, so it is going to use < p > tags as well.

  3. marmelade
    Member
    Posted 10 years ago #

    Is there a way to remove the tags then? I don't like < p >

  4. chuyskywalker
    Member
    Posted 10 years ago #

    There is no "check box to remove < p > tags" option in WordPress as the P tag is a vital atribute for valid HTML pages.

    You could write a plugin to disable wpautop() (the function that is formatting your posts) and replace it with nl2br() - a function that will do what you want.

    If you're not up to that, let me know and I'll crank it out for you.

  5. marmelade
    Member
    Posted 10 years ago #

    I have no idea of how to do that, so I'll have to ask you to help me out =)

  6. dherren
    Member
    Posted 10 years ago #

    Out of curiosity, why don't you "like" paragraph tags? What is there to like or not like. It's html?

    Do you just want to be able to start a new line on the next line without the added space between paragraphs? If so, markdown WILL do that for you.

  7. chuyskywalker
    Member
    Posted 10 years ago #

    put this in a file called 'just-br.php' and upload it to you plugins directory. activate and be done.


    <?php
    /*
    Plugin Name: Just-BR
    Description: Switch the wpautop to nl2br
    Author: Jeff Minard
    Version: 1.0
    Author URI: http://thecodepro.com/
    */

    remove_filter('the_content', 'wpautop');
    remove_filter('the_excerpt', 'wpautop');
    remove_filter('comment_text', 'wpautop');

    add_filter('the_content', 'nl2br', 1);
    add_filter('the_excerpt', 'nl2br', 1);
    add_filter('comment_text', 'nl2br', 1);
    ?>

  8. chuyskywalker
    Member
    Posted 10 years ago #

    and make sure there are no spaces before or after the <? and ?>

  9. marmelade
    Member
    Posted 10 years ago #

    Thanks for the script, but it didn't help. I'd like the < p > on the content of the post to go away. It's no big deal, but it would be nice to have more control over the layout.

  10. weschilders
    Member
    Posted 10 years ago #

    Is there a way to make this apply to custom fields as well as the standard post field?

    Wes

  11. wrong
    Member
    Posted 10 years ago #

    "I'd like the < p > on the content of the post to go away."

    I think, as the old saying goes, the solution is to stop wanting that. Seriously, I'm not clear on how removing the < p > would give you more control over the layout. Maybe if you say in more detail what you want the layout to be like, people could suggest ways of styling the < p > to achieve it.

    Another thought that comes to mind is wrapping the whole post in a < div > - markdown knows that < div >'s are legitimate block-level elements, and so shouldn't wrap the text inside in a < p >. But I can't think of any reason to prefer a < div > over a < p >.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.