Inline styles mystery

Lou Quillio public at
Thu Dec 9 20:11:18 EST 2004

Hash: SHA1

[Not sure why this didn't become a top-level post.  Thought subject:
lines controlled things.]

Reversing the application of SmartyPants and Markdown cleared up a
few issues with the Drupal module.  It *had* been educating quotes
around attribute values in my inline `<img>` tag, and doesn't now.

But there's still a bunch of undesired transformation on those
attributes, and it's inconsistent.  Leave the quotes off some
(width, height) and Markdown applies them.  `alt` or `title`
attributes with spaces in the values?  Fuhgetaboutit.  Total
garbage.  Why is it making judgments about these at all?

I think these transformations are artifacts of earlier Markdown
ambitions since discarded, attempts to impose validity on anything
thrown at it.

But it seems that Markdown monkeys with literal inline `<img>`
attributes (and maybe others), rendering this untrue:

"For any markup that is not covered by Markdown?s syntax, you simply
use HTML itself. There?s no need to preface it or delimit it to
indicate that you?re switching from Markdown to HTML; you just use
the tags."[1]


I figure it's just a low-priority code cleanup that hasn't happened
yet.  Confirm?


Lou Quillio wrote:
> 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=""
> 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=""
> 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=""
> 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
> ++++++++++++++++++++++++++++++++++++
Markdown-discuss mailing list
Markdown-discuss at
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -


More information about the Markdown-discuss mailing list