Question re images in Discourse

This is a probably very trivial question to @Sujato: how did you mange to get images to float right in Discourse posts?

1 Like

I’ve been waiting for someone to ask that! I looked into this when working on the Wiki thing. Discourse has awesome image handling, but no way of controlling the appearance. When I was bored one day I figured out an evil hack to do this:

.cooked em img:not(.emoji) {
float: right;
padding: 0 0 0.5em 2%;
max-width: 48%;
height: auto;
}

Then just surround your image with *asterisks* and voila it floats right! It’s based on the assumption that there’s no reason to make your images italic.

2 Likes

Asterisks … I saw the hack and assumed it was underscores … (which it does when you click the I at the top)
Is it correct that it then still does not show up on the right in the preview?

O, either, they’re the same in Markdown.

Yes.

I should mention that I find it quite useful, but there’s no telling how robust it will be. But anyway, at worst the images would just behave as normal.

1 Like