tag:support.fletcherpenney.net,2013-02-12:/discussions/questions/48-can-image-width-height-attributes-be-applied-as-attributes-instead-of-styleMultiMarkdown: Discussion 2021-05-09T18:18:07Ztag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-02T20:10:57Z2013-09-02T20:10:58ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>When reading the old(?) <a href=
"https://github.com/fletcher/MultiMarkdown/wiki/MultiMarkdown-Syntax-Guide">
MultiMarkdown Style Guide</a> I got the impression that image
attributes in conversion to HTML would be applied as attributes on
the image tag, but when testing it seems as my <code>width</code>
and <code>height</code> attributes are used as values for a
<code>style</code> attribute instead.</p>
<p>Is there a way to preserve them as individual attributes?</p></div>Danieltag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-02T20:12:47Z2013-09-02T20:12:49ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>(I'm using MultiMarkdown 4.2.)</p></div>Danieltag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-02T20:15:43Z2013-09-02T20:15:44ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>(The link above should have said MultiMarkdown Syntax
Guide.)</p></div>Danieltag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-02T20:23:17Z2013-09-02T20:23:17ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>Daniel,</p>
<p>You can always define an image manually in HTML, but when you
use MMD the width/height are applied as style.</p>
<p>May I ask why it matters to you?</p>
<p>Fletcher</p></div>fletchertag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-02T21:24:00Z2013-09-02T21:24:01ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>Hi Fletcher, and thanks for the super fast response. And your
fantastic tool.</p>
<p>I don't know if browsers handle these two expressions
differently, but I know there are lots of recommendations for
specifying width and height for images so the browser can allocate
the needed space as it traverse the DOM and renders the page. I'm
sure that the width and height attributes will be picked up at the
right time, I'm not sure about the style rules.</p>
<p>It probably could be debated but to me it is the clearest way of
expressing this information about the image. It isn't really a
style, it's a description of the resource. I tend to avoid inline
style, and keeping this information in the tag attributes is a
reminder that this is something different.</p>
<p>Also, it would probably be the least surprising thing, and maybe
save a line of code in your parser ... And should you chose to
change this behavior to the one I expected, it would still be
possible (but more verbose) to add them as style values, while it
now seems "impossible" (without resorting to additional filters) to
add them as attributes.</p>
<p>Regards<br>
Daniel</p></div>Danieltag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-02T21:26:17Z2013-09-02T21:26:18ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>(And now I read your response again, and saw the answer to my
"impossible" right there. But I would much prefer the
reference-style image syntax.)</p></div>Danieltag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-02T21:29:16Z2013-09-02T21:29:16ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>Fair enough. No promises, but I'll look at changing it.</p>
<p>F-</p>
<h2><a name="" href="#" class="anchor"></a></h2>
<p>Fletcher T. Penney<br>
<a href=
"mailto:fletcher@fletcherpenney.net">fletcher@fletcherpenney.net</a></p></div>fletchertag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-05T12:40:22Z2013-09-05T12:40:22ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>When I test in Chrome, the width/height work just fine when
specified as style attributes for "blocking out" the image
dimensions when image is unavailable.</p>
<p>Has that not been the case for you?</p>
<p>F-</p></div>fletchertag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-05T21:04:37Z2013-09-05T21:04:41ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>Yes it works for me to. My main concern was really my subjective
opinion on what "looks best". The other concern was performance
rather than functionality - it <em>might</em> be that the time that
the inline style gets picked up/calculated is too late to prevent
an additional reflow of the page. But even if it is so, I'm not
publishing anything where it would be significant.</p>
<p>I also found <a href=
"http://stackoverflow.com/a/2414940/198420">this Stackoverflow
answer</a> that suggested this to be the most correct way, but
there are other opinions.</p>
<p>Thanks for taking your time, but don't lose sleep over this. I
will appreciate it you change it, or add an option (but going down
that path is probably a never ending road for you), but I will live
happily even if you don't.</p>
<p>Regards<br>
Daniel</p></div>Danieltag:support.fletcherpenney.net,2013-02-12:Comment/285892612013-09-05T21:23:42Z2013-09-05T21:23:42ZCan image width-/height-attributes be applied as attributes instead of style?<div><p>For now, this will be filed under "Do it when I get around to
it, either out of boredom, or because I've accomplished everything
else." If it turns out to actually cause a problem, I will bump it
up the priority ladder. Just let me know.</p>
<p>F-</p>
<h2><a class="anchor" name="" href="#"></a></h2>
<p>Fletcher T. Penney<br>
<a href=
"mailto:fletcher@fletcherpenney.net">fletcher@fletcherpenney.net</a></p></div>fletcher