Can image width-/height-attributes be applied as attributes instead of style?

Daniel's Avatar

Daniel

02 Sep, 2013 08:10 PM

When reading the old(?) MultiMarkdown Style Guide 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 width and height attributes are used as values for a style attribute instead.

Is there a way to preserve them as individual attributes?

  1. 1 Posted by Daniel on 02 Sep, 2013 08:12 PM

    Daniel's Avatar

    (I'm using MultiMarkdown 4.2.)

  2. 2 Posted by Daniel on 02 Sep, 2013 08:15 PM

    Daniel's Avatar

    (The link above should have said MultiMarkdown Syntax Guide.)

  3. Support Staff 3 Posted by fletcher on 02 Sep, 2013 08:23 PM

    fletcher's Avatar

    Daniel,

    You can always define an image manually in HTML, but when you use MMD the width/height are applied as style.

    May I ask why it matters to you?

    Fletcher

  4. 4 Posted by Daniel on 02 Sep, 2013 09:24 PM

    Daniel's Avatar

    Hi Fletcher, and thanks for the super fast response. And your fantastic tool.

    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.

    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.

    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.

    Regards
    Daniel

  5. 5 Posted by Daniel on 02 Sep, 2013 09:26 PM

    Daniel's Avatar

    (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.)

  6. Support Staff 6 Posted by fletcher on 02 Sep, 2013 09:29 PM

    fletcher's Avatar

    Fair enough. No promises, but I'll look at changing it.

    F-

    --
    Fletcher T. Penney
    [email blocked]

  7. Support Staff 7 Posted by fletcher on 05 Sep, 2013 12:40 PM

    fletcher's Avatar

    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.

    Has that not been the case for you?

    F-

  8. 8 Posted by Daniel on 05 Sep, 2013 09:04 PM

    Daniel's Avatar

    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 *might* 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.

    I also found [this Stackoverflow answer](http://stackoverflow.com/a/2414940/198420) that suggested this to be the most correct way, but there are other opinions.

    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.

    Regards
    Daniel

  9. Support Staff 9 Posted by fletcher on 05 Sep, 2013 09:23 PM

    fletcher's Avatar

    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.

    F-

    --
    Fletcher T. Penney
    [email blocked]

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

11 Dec, 2022 09:57 PM
11 Dec, 2022 07:57 PM
26 Sep, 2022 02:40 AM
21 Jul, 2022 10:22 AM
11 Jan, 2022 02:33 PM

Recent Articles