Inline styles mystery
Lou Quillio
public at quillio.com
Thu Dec 9 14:20:29 EST 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've stumbled onto some curious Markdown behavior today, while
trying to figure why Drupal's MarkSmarty module is educating quotes
around explicit-HTML attributes (it applies SmartyPants after
Markdown, I'm using Michel's current php modules, and MarkSmarty
applies them as-is). Anyhow ...
Run this passage through the Markdown dingus:
************************
This paragraph contains a right-floated image of Michel Fortin, and
the image is cleared-right so the second paragraph wraps. <img
src="http://www.michelf.com/img/photo/michel-fortin-arbre.jpg"
alt="" width="155" height="155" style="float:right; clear:right;
border:none; padding:1em;" /> Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Vivamus eget augue vel ante
ullamcorper euismod. Sed suscipit vestibulum dolor. Nullam leo diam,
feugiat eu, tristique eget, posuere sed, nibh. Morbi consectetuer
pede sit amet sem.
Class aptent taciti sociosqu ad litora torquent per conubia nostra,
per inceptos hymenaeos. Cras ullamcorper. Pellentesque turpis nunc,
nonummy nec, ultricies vitae, accumsan sed, augue. Pellentesque
habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. In pellentesque. Etiam id leo quis eros semper
gravida. Nunc placerat fringilla tortor. Curabitur sapien odio,
venenatis et, facilisis euismod, pharetra non, sem. Curabitur vel velit.
************************
The Markdown-generated HTML Source is exactly what I'd expect and
want. But the image tag is broken, and if you examine the page
source you'll see that image tag as output for the HTML Preview is
something quite different from the intended HTML Source:
<img src="http://www.michelf.com/img/photo/michel-fortin-arbre.jpg"
alt="" style="border: medium none ; padding: 1em; float: right;
clear: right;" height="155" width="155">
The trailing slash has been stripped; tweaking
`$md_empty_element_suffix` doesn't seem to change this. More, the
style properties are reordered, respaced, and altered. A
superfluous "medium" value has been added to the border property.
Now change my original input to "clear:left":
<img src="http://www.michelf.com/img/photo/michel-fortin-arbre.jpg"
alt="" style="border: medium none ; padding: 1em; float: right;
clear: left;" height="155" width="155">
Okay, so the image tag wasn't broken, just interacting badly with
its container elements. But I've still lost my trailing slash,
still have the extra "medium" (??), and the properties and values
are again not what I keyed.
The image tag is inline HTML. Shouldn't it be literally untouched
by Markdown (hands-off my trailing slash)? And I was very surprised
to see it reaching into my style attribute. Also, shouldn't the
final output be identical to the HTML Source output? Or is there
something I'm not getting?
I can get around it, but wassup? I need to understand this before
tackling the MarkSmarty problem -- which incidentally hasn't broken
in any other way so far, and doesn't do much more than this:
return SmartyPants(Markdown($text));
Thoughts?
LQ
++++++++++++++++++++++++++++++++++++
Lou Quillio
Box 459, Cambridge, NY USA 12816
http://quillio.com/
++++++++++++++++++++++++++++++++++++
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBuKV8Wb6NuB4EK7oRAq5KAJwPQiECG8onhuxNVxbD0kpQafyTCACdGtct
p/wZ7DiAjbm9i+5a5aTIw3Q=
=zaWC
-----END PGP SIGNATURE-----
More information about the Markdown-discuss
mailing list