Log in Sign up

Workaround for Hash-Hack

CommonMark doesn't support the CSS styles extension, so I am using a HashHack to style images.

For example an image beer.jpg with HashHack would look like beer.jpg#left30, which is then declared in CSS as img[src*="#left30"]. This is somewhat cumbersome and doesn't really allow nesting or precedence, but it works.

However, if I am checking the "optimize and cache" in Blot's settings, the hash is (this is 100% within the standard, I am not complaining) discarded.

So I need a different way to style images that does not involve using img tags (well, I could, but I am trying to convince academics to use this, and they're famously tech-illiterate :).

Any ideas?


3 years ago, 2 replies   Edit question

I don't have a good answer for you unfortunately. If I were you, I'd disable the “optimize and cache” setting on the services page.

I'm reluctant to make any changes to Blot regarding this. I think preserving the fragment should be beyond the scope of the "optimise and cache images" feature.

If you're trying to get people who are uncomfortable with Markdown/HTML to use Blot, I'd consider easing them in with Word Documents – Blot can turn them into posts, and adding images is easy.

I'm always happy to reconsider, so please push me if you feel like it!

Answered 3 years ago · Edit answer

I fully agree with you, especially since fragments should not be preserved anyway (that's why it's a hack). I'll see what I can do on my end to make this user friendly on the user side of things without compromising server side sanity.

Answered 3 years ago · Edit answer