Paragraph tags around <div> blocks

Sherwood Botsford sgbotsford at gmail.com
Thu Mar 5 22:11:12 EST 2009


For those of you who are expert you may chuckle over this.
Perhaps if it's in the record, however, it may help someone else.


I was getting cases of

<div id="content">

standing on a line by itself, getting converted to this:

<p><div id="content"></p>


Yes, the line above and below are blank.
Yes the div tag is starting at the first column

It displays as intended. Firefox's browser is clever, but it won't
validate, and given all the whinging
I've done about non-validating web pages, I better get mine right.


I'm processing with template toolkit. If I turn off the multimarkdown
filter, this is what's being passed:
32 <div class="sidepix">
33 <img src="/Images/sidepix/rotate.php"
34 alt = "Random scenic picture" />
35 </div>
36 </div>
37 <!-- End of SideNav -->
38
39
40
41 <div id="content">
42
43 # Contact Info
44 If you want to write, phone, email, drive here this is the place to
45 find out how.
46

32 <div class="sidepix">
33 <img src="/Images/sidepix/rotate.php"
34 alt = "Random scenic picture" />
35 </div>
36 </div>
37 <!-- End of SideNav -->
38
39 <p><div id="content"></p>
40
41 <h1 id="contactinfo">Contact Info</h1>
42
43 <p>If you want to write, phone, email, drive here this is the place to
44 find out how. </p>
45

As a sanity check I reverted to Markdown instead of multimarkdown

No change.

Now it wasn't happening in all files

An hour of pruning copies of files that worked versus ones that didn't
found the following:

This file would work:

[% USE MARKDOWN %]
[% FILTER MARKDOWN %]

<div id=foo>
</div>

[% END #filter markdown %]


This file would not work:
[% USE MARKDOWN %]
[% FILTER MARKDOWN %]

<div id=foo>


[% END #filter markdown %]
</div>

The [% boxes are template toolkit instructions.
So TT was NOT handling markdown the closing </div> in the non-working cases.
Markdown couldn't find a closing tag to match the opening tag,
therefore it must be text,
and gets wrapped in <p> tags.

Go figure.

--
Sherwood Botsford
Sherwood's Forests
Warburg, Alberta T0C 2T0
http://www.sherwoods-forests.com
780-848-2548


More information about the Markdown-Discuss mailing list