• I’m new, new, new to WordPress. My blog (currently using Blosxom) is a bit weird, I guess, in that I present an article from an old newspaper (as well as other sources) and then have a separate section of commentary/epilogue within the same post. An example: https://logiston.com/oddends/SameToday/Item187.digitalPaper (If you look at the source, you’ll see it doesn’t validate because of improperly nested <p>‘s)

    What I want to do is have my commentary styled differently from the main part of the post. This is different from just a blockquote, in that I’d like to sometimes have blockquotes within the main part of the post as well as the commentary section.

    I would like to use a <div class="annotation"> and have Markdown still style the stuff inside the divs. It will, if I separate the divs from the text, but then it wraps <p> markers around the <div>. This breaks the validation.

    In WordPress, I have tried to use Textile (same problem), and I also tried to use the text-replace plugin (to put custom begin/end markers around the annotation). If I set text-replace to run first, then Markdown doesn’t style the text inside the div, and if I do it the other way, then text-replace doesn’t remove the Markdown-added paragraphs markers.

    Any hints? Clues? Pointers? Help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter logista

    (@logista)

    Ok, I “fixed” it. In a word: kludge.

    In my post, I have a comment: <!-- begin_annote --> which Markdown properly ignores (and a similar one at the end of the annotation section)

    In text-replace, I have a hard-coded replacement string to force it to look at the <> characters (which it normally would ignore). So, after the nice generic preg_replace I’ve put
    $text = preg_replace("<!-- annote_begin -->", "div class=\"annote\"", $text);

    (If I use "<div class... then I get an extra < which is why it’s not included in the replacement string.)

    Ugly, but it works for me. And considering I don’t know PHP from Pepsi… Thank heavens for people putting their knowledge on the web!

    Thread Starter logista

    (@logista)

    oops. the comment in the post is actually <!-- annote_begin -->

    Nice workaround. Markdown formatting inside div and other block-level tags is planned for a future version (probably 1.1). Until then, this is a nice trick indeed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘in-post <div> and markdown?’ is closed to new replies.