welpo / tabi

A modern Zola theme with search, multilingual support, optional JavaScript, a perfect Lighthouse score, and a focus on accessibility.
https://welpo.github.io/tabi/
MIT License
97 stars 32 forks source link

Add inline image in text #314

Closed stalkerGH closed 1 month ago

stalkerGH commented 1 month ago

I asked on general Zola board (https://zola.discourse.group) but maybe I can try here too.

I’d like to add small inline image, directly in text. If I add tag directly in .md file, it renders as separate paragraph:

first part of text

IMAGE

rest of text

But I’d like to have it like this: “some text IMAGE and some text again”.

How (and if) can I achieve that in Zola & Tabi?

welpo commented 1 month ago

It wasn't possible with tabi's CSS. I've added (6a4f4244e0ae16127f207680061fa4dcb1c782dd) a new class for images, inline, which allows you to do this.

To use it, you'll need to specify the inline class on the image. To embed the image, use HTML:

Some text <img src="path/to/img.png" class="inline" alt="Descriptive text"> and some more text.

I've made it so the image gets vertically aligned with the text, hoping that fits most use cases for this class.

Let me know whether that helps.


As to why I made all images centered and in a new line: I want centered images on my posts. So far, I haven't had to use an inline image. In choosing a default, I chose the one I saw most use for. Making inline images the default (which it is without CSS) would make adding centered images more cumbersome.

Hope that makes sense!

stalkerGH commented 1 month ago

Thank you very much! Yes, it works like a charm. Little change in the code but great effect :)

stalkerGH commented 1 month ago

The problem is solved so I close the issue.

welpo commented 1 month ago

@stalkerGH if you're interested, now you can use all image shortcodes with the inline option (#315)

stalkerGH commented 1 month ago

Yes, indeed I'm interested. Thank you for this new feature :)

welpo commented 1 month ago

Thank you for the idea!