Allow floating images to start/end of a paragraph
This commit is contained in:
@ -178,7 +178,9 @@ Available variables are:
|
|||||||
- `url`: URL to an image.
|
- `url`: URL to an image.
|
||||||
- `url_min`: URL to compressed version of an image, original can be opened by clicking on the image.
|
- `url_min`: URL to compressed version of an image, original can be opened by clicking on the image.
|
||||||
- `alt`: Alt text, same as if the text were inside square brackets in Markdown.
|
- `alt`: Alt text, same as if the text were inside square brackets in Markdown.
|
||||||
- `full`: Forces image/video to be full-width.
|
- `full`: Forces image to be full-width.
|
||||||
|
- `start`: Float image to the start of paragraph and scale it down.
|
||||||
|
- `end`: Float image to the end of paragraph and scale it down.
|
||||||
- `pixels`: Uses nearest neighbor algorithm for scaling, useful for keeping pixel-art sharp.
|
- `pixels`: Uses nearest neighbor algorithm for scaling, useful for keeping pixel-art sharp.
|
||||||
- `transparent`: Removes rounded corners and shadow, useful for transparent images.
|
- `transparent`: Removes rounded corners and shadow, useful for transparent images.
|
||||||
- `no_hover`: Removes zoom on hover.
|
- `no_hover`: Removes zoom on hover.
|
||||||
@ -197,14 +199,21 @@ Variables should be comma-separated and be inside the brackets.
|
|||||||
|
|
||||||
Alternatively, you can append the following URL anchors. It can be more handy in some cases, e.g such images will render normally in any Markdown editor, opposed to the Zola shortcodes.
|
Alternatively, you can append the following URL anchors. It can be more handy in some cases, e.g such images will render normally in any Markdown editor, opposed to the Zola shortcodes.
|
||||||
|
|
||||||
- `#full`: Forces image/video to be full-width.
|
- `#full`: Forces image to be full-width.
|
||||||
|
- `#start`: Float image to the start of paragraph and scale it down.
|
||||||
|
- `#end`: Float image to the end of paragraph and scale it down.
|
||||||
- `#pixels`: Uses nearest neighbor algorithm for scaling, useful for keeping pixel-art sharp.
|
- `#pixels`: Uses nearest neighbor algorithm for scaling, useful for keeping pixel-art sharp.
|
||||||
- `#transparent`: Removes rounded corners and shadow, useful for transparent images.
|
- `#transparent`: Removes rounded corners and shadow, useful for transparent images.
|
||||||
- `#no-hover`: Removes zoom on hover.
|
- `#no-hover`: Removes zoom on hover.
|
||||||
|
|
||||||
|
\
|
||||||

|

|
||||||
<figcaption>Full-width image with an alt text, pixel-art rendering, no shadow and rounded corners, and no zoom on hover</figcaption>
|
<figcaption>Full-width image with an alt text, pixel-art rendering, no shadow and rounded corners, and no zoom on hover</figcaption>
|
||||||
|
|
||||||
|
\
|
||||||
|

|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore dolemus, fieri tamen permagna accessio potest, si aliquod aeternum et infinitum impendere malum nobis opinemur.
|
||||||
|
|
||||||
#### Video
|
#### Video
|
||||||
|
|
||||||
Same as images, but with a few differences: `no_hover` and `url_min` are not available.
|
Same as images, but with a few differences: `no_hover` and `url_min` are not available.
|
||||||
|
@ -11,6 +11,45 @@ video {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.start,
|
||||||
|
&.end,
|
||||||
|
&[src*="#start"],
|
||||||
|
&[src*="#end"] {
|
||||||
|
margin: 0;
|
||||||
|
width: 30%;
|
||||||
|
|
||||||
|
@media only screen and (max-width: 720px) {
|
||||||
|
float: none;
|
||||||
|
margin-inline-start: 0;
|
||||||
|
margin-inline-end: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.start,
|
||||||
|
&[src*="#start"] {
|
||||||
|
float: left;
|
||||||
|
transform-origin: left;
|
||||||
|
margin-inline-end: 1rem;
|
||||||
|
|
||||||
|
:root[dir="rtl"] & {
|
||||||
|
float: right;
|
||||||
|
transform-origin: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.end,
|
||||||
|
&[src*="#end"] {
|
||||||
|
float: right;
|
||||||
|
transform-origin: right;
|
||||||
|
margin-inline-start: 1rem;
|
||||||
|
|
||||||
|
:root[dir="rtl"] & {
|
||||||
|
float: left;
|
||||||
|
transform-origin: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.pixels,
|
&.pixels,
|
||||||
&[src*="#pixels"] {
|
&[src*="#pixels"] {
|
||||||
image-rendering: pixelated;
|
image-rendering: pixelated;
|
||||||
@ -35,6 +74,23 @@ img {
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.start,
|
||||||
|
&.end,
|
||||||
|
&[src*="#start"],
|
||||||
|
&[src*="#end"] {
|
||||||
|
&:hover {
|
||||||
|
transform: scale(1.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 720px) {
|
||||||
|
transform-origin: unset;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.transparent,
|
&.transparent,
|
||||||
&[src*="#transparent"] {
|
&[src*="#transparent"] {
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -2,20 +2,24 @@
|
|||||||
<a href="{{ url }}">
|
<a href="{{ url }}">
|
||||||
<img class="
|
<img class="
|
||||||
{% if full %}full{% endif %}
|
{% if full %}full{% endif %}
|
||||||
|
{% if start %}start{% endif %}
|
||||||
|
{% if end %}end{% endif %}
|
||||||
{% if pixels %}pixels{% endif %}
|
{% if pixels %}pixels{% endif %}
|
||||||
{% if transparent %}transparent{% endif %}
|
{% if transparent %}transparent{% endif %}
|
||||||
{% if no_hover %}no-hover{% endif %}
|
{% if no_hover %}no-hover{% endif %}
|
||||||
"
|
"
|
||||||
{%- if alt -%}alt="{{alt}}"{%- endif -%}
|
{%- if alt -%}alt="{{ alt }}"{%- endif -%}
|
||||||
src="{{ url_min }}" />
|
src="{{ url_min }}" />
|
||||||
</a>
|
</a>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<img class="
|
<img class="
|
||||||
{% if full %}full{% endif %}
|
{% if full %}full{% endif %}
|
||||||
|
{% if start %}start{% endif %}
|
||||||
|
{% if end %}end{% endif %}
|
||||||
{% if pixels %}pixels{% endif %}
|
{% if pixels %}pixels{% endif %}
|
||||||
{% if transparent %}transparent{% endif %}
|
{% if transparent %}transparent{% endif %}
|
||||||
{% if no_hover %}no-hover{% endif %}
|
{% if no_hover %}no-hover{% endif %}
|
||||||
"
|
"
|
||||||
{%- if alt -%}alt="{{alt}}"{%- endif -%}
|
{%- if alt -%}alt="{{ alt }}"{%- endif -%}
|
||||||
src="{{ url }}" />
|
src="{{ url }}" />
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<video class="
|
<video class="
|
||||||
{% if full %}full{% endif %}
|
{% if full %}full{% endif %}
|
||||||
|
{% if start %}start{% endif %}
|
||||||
|
{% if end %}end{% endif %}
|
||||||
{% if pixels %}pixels{% endif %}
|
{% if pixels %}pixels{% endif %}
|
||||||
{% if transparent %}transparent{% endif %}
|
{% if transparent %}transparent{% endif %}
|
||||||
"
|
"
|
||||||
{%- if alt -%}alt="{{alt}}"{%- endif -%}
|
{%- if alt -%}alt="{{ alt }}"{%- endif -%}
|
||||||
controls src="{{url}}"></video>
|
controls src="{{ url }}"></video>
|
||||||
|
Reference in New Issue
Block a user