• In a blog entry, I’m inserting xml code encoded using the WordPress Encoder Widget, inside a ‘pre’ element. For some reason, WordPress inserts ‘p’ elements after some of the lines, resulting in extra blank lines in teh listing. The placement seems to be completely random, but it’s at the same place every time.
    Does anybody know why this is happening? I’m going crazy trying to put program listings inside a blog entry. I’m not completely happy about having to use the Encoder Widget to encode everything (instead of using CDATA or some other markup mechanism), but it would have been workable,. However with these blank lines in the result this is not an option either.
    Regards,
    Colin

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter colins

    (@colins)

    Doing some reading, I guess this is related to the ‘autop’ function that adds ‘p’ elements automatically? It seems like the ‘p’s are only added when there is a blank line in the text inside the pre (i.e. double new line).
    I figured out one workaround, which is to add & nbsp; at the beginning of all blank lines, but it would be really nice to have WP automatically stop adding the ‘p’s inside the ‘pre’ tag, since the whole point of the ‘pre’ tag is that it is already formatted.
    Regards,
    Colin

    Thread Starter colins

    (@colins)

    Thanks, I figured that out after looking at some comments. But I don’t really see it as an option. All my normal text then runs together, and I have to manually wrap text myself with ‘p’ (looks like ‘br’ gets stripped too). Ideally, I think the autop functionality should be able to handle ‘pre’ tags and not touch anything in there…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress adds its own ‘p’ elements inside ‘pre’ is closed to new replies.