Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Allow width, height, and valign attributes on img tags #50

Merged
merged 1 commit into from
Oct 5, 2015

Conversation

rreusser
Copy link
Contributor

I filed an issue (in hindsight, for the wrong repo) at npm/newww#1107. In short width, height, and valign attributes are allowed on github and disallowed on npmjs.com which makes it rather difficult to achieve visual consistency between the two.

Some examples:

Basically any image with a fixed width and height loses it when published to npm (i.e. the only non-css way to use retina images—and I'd use SVG except SVG has its own issues on github). I know this will affect the look of quite a few READMEs on npm so I don't take this lightly, but I think there's a pretty good argument to be made that will only fix visual inconsistencies rather than creating them since it's not clear why you'd set these attributes and prefer that they not be obeyed.

Tests are added. I can't think of any other issues like security that this would interfere with.

Thanks for your consideration!

@rreusser
Copy link
Contributor Author

Note: I added and then removed <p> tags + the align attribute since it's a common github-friendly way to center-align things, but I'll take this one step at a time since that may cause more sanitization issues (although I suspect it's probably fine and bad <p> tags get sanitized anyway).

@zeke
Copy link
Contributor

zeke commented Jul 29, 2015

Looks good to me. I don't have commit bit on this repo any more, though.

@rreusser
Copy link
Contributor Author

rreusser commented Aug 1, 2015

Thanks, @zeke! We'll see! 👍

@sindresorhus
Copy link

@othiym23 Can someone merge this? It's annoying that logos and stuff goes fullwidth.

Examples:

@othiym23
Copy link

othiym23 commented Sep 3, 2015

This isn't a code base I have a lot of contact with, so it would be better for @rockbot, @jefflembeck, or @aredridel to take a look at landing this one. It may be a bit, too, as they're heads down right now.

@bcoe
Copy link
Contributor

bcoe commented Sep 3, 2015

@soldair would be a good person to reach out to as well, he's working on patching some dependencies of the library right now.

@sindresorhus
Copy link

An additional note, GitHub applies a max-width:100%; to images to make sure the user can't set a width wider than the page. You should probably do the same on npmjs.com before deploying this.

@rreusser
Copy link
Contributor Author

rreusser commented Sep 4, 2015

@soldair
Copy link
Contributor

soldair commented Sep 4, 2015

lgtm - ill check this out after i resolve another issue

@wooorm
Copy link

wooorm commented Sep 4, 2015

👍

@mattdesl
Copy link

mattdesl commented Oct 5, 2015

Any progress on this @soldair?

Particularly bad case below.

npm:

screen shot 2015-10-05 at 4 53 53 pm

github:

screen shot 2015-10-05 at 4 54 05 pm

@aredridel
Copy link
Contributor

LGTM too. Our max-width is already 100% so good to go.

aredridel added a commit that referenced this pull request Oct 5, 2015
Allow width, height, and valign attributes on img tags
@aredridel aredridel merged commit b6e752b into npm:master Oct 5, 2015
@mattdesl
Copy link

mattdesl commented Oct 5, 2015

🎉 thanks!

@rreusser
Copy link
Contributor Author

rreusser commented Oct 5, 2015

The inspector and a search (link above) suggested that markdown.styl in npm/newww contains the max-width property in question. I'd do a bit more sleuthing and track down the fix, but that's my best guess for what we're talking about. Am I misunderstanding the level on which this needs to happen?

@rreusser
Copy link
Contributor Author

rreusser commented Oct 5, 2015

Oops. Slow on the comment. 😄

@rreusser
Copy link
Contributor Author

rreusser commented Oct 5, 2015

Thanks for the merge! 👻

@aredridel
Copy link
Contributor

You're welcome! We'll roll this out with the next updates, probably!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants