Skip to content

Commit c4d39c2

Browse files
committed
Switching from prettier pre-commit check to biome
1 parent 68d2d8a commit c4d39c2

4 files changed

Lines changed: 63 additions & 32 deletions

File tree

.pre-commit-config.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ repos:
99
- id: check-toml
1010
- id: check-added-large-files
1111
args: [--maxkb=800]
12-
# Run Prettier
13-
- repo: https://github.com/pre-commit/mirrors-prettier
14-
rev: v2.7.1
12+
# Run Biome
13+
- repo: https://github.com/biomejs/pre-commit
14+
rev: v2.0.0-beta.3 # Use the sha / tag you want to point at
1515
hooks:
16-
- id: prettier
16+
- id: biome-check
17+
# Run Prettier - Deprecated
18+
# - repo: https://github.com/pre-commit/mirrors-prettier
19+
# rev: v2.7.1
20+
# hooks:
21+
# - id: prettier
1722
# Run Zola check to validate external links (https://www.getzola.org/documentation/getting-started/cli-usage/#check)
1823
# Disabling for now
1924
#- repo: local

sass/main.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ mark {
104104

105105
img {
106106
display: block;
107-
height: auto;
108107
width: 100%;
108+
height: auto;
109109
max-width: 100%;
110110
border-radius: 4px;
111111

@@ -197,6 +197,13 @@ figure {
197197
}
198198
}
199199

200+
figure img {
201+
display: block;
202+
width: 100%;
203+
height: auto;
204+
aspect-ratio: attr(width) / attr(height); // Fallback for browsers that support it
205+
}
206+
200207
code {
201208
font-family: Hack, DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
202209
font-feature-settings: normal;

templates/shortcodes/figure.html

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
{% if src %}
22
<figure class="{% if position %}{{ position }}{% else -%} center {%- endif %}">
3-
{% set abspath = "/static/" ~ src %} {% set meta =
4-
get_image_metadata(path=abspath) %} {% set width = meta.width %} {% set
5-
srcset_list = [] %} {% for s in config.extra.images_sizes %} {% if width >= s
6-
%} {% set resized = resize_image(path=abspath, width=s, op="fit_width",
7-
format="webp", quality=90) %} {% set element = resized.url ~ " " ~ s ~ "w" %}
8-
{% set_global srcset_list = srcset_list | concat(with=[element]) %} {% endif
9-
%} {% endfor %} {% set default_resized = resize_image(path=abspath,
10-
width=config.extra.images_default_size, op="fit_width", format="webp",
11-
quality=90) %} <img alt="{{ alt }}" src="{{ default_resized.url | safe }}"
12-
srcset="{{ srcset_list | join(sep=", ") | safe }}" /> {% if caption %}
3+
{% set abspath = "/static/" ~ src %}
4+
{% set meta = get_image_metadata(path=abspath) %}
5+
{% set width = meta.width %}
6+
{% set height = meta.height %}
7+
{% set srcset_list = [] %}
8+
{% for s in config.extra.images_sizes %}
9+
{% if width >= s %}
10+
{% set resized = resize_image(path=abspath, width=s, op="fit_width", format="webp", quality=90) %}
11+
{% set element = resized.url ~ " " ~ s ~ "w" %}
12+
{% set_global srcset_list = srcset_list | concat(with=[element]) %}
13+
{% endif %}
14+
{% endfor %}
15+
{% set default_resized = resize_image(path=abspath, width=config.extra.images_default_size, op="fit_width", format="webp", quality=90) %}
16+
<img
17+
alt="{{ alt }}"
18+
src="{{ default_resized.url | safe }}"
19+
srcset="{{ srcset_list | join(sep=", ") | safe }}"
20+
width="{{ width }}"
21+
height="{{ height }}"
22+
style="aspect-ratio: {{ width }}/{{ height }};"
23+
/>
24+
{% if caption %}
1325
<figcaption
1426
class="{% if caption_position %}{{ caption_position }}{% else -%} center {%- endif %}"
15-
{%
16-
if
17-
caption_style
18-
%}
27+
{% if caption_style %}
1928
style="{{ caption_style | safe }}"
20-
{%
21-
endif
22-
%}
29+
{% endif %}
2330
>
2431
{{ caption }}
2532
</figcaption>

templates/shortcodes/image.html

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
{% set abspath = "/static/" ~ src %} {% set meta =
2-
get_image_metadata(path=abspath) %} {% set width = meta.width %} {% set
3-
srcset_list = [] %} {% for s in config.extra.images_sizes %} {% if width >= s %}
4-
{% set resized = resize_image(path=abspath, width=s, op="fit_width",
5-
format="webp", quality=90) %} {% set element = resized.url ~ " " ~ s ~ "w" %} {%
6-
set_global srcset_list = srcset_list | concat(with=[element]) %} {% endif %} {%
7-
endfor %} {% set default_resized = resize_image(path=abspath,
8-
width=config.extra.images_default_size, op="fit_width", format="webp",
9-
quality=90) %} <img alt="{{ alt }}" src="{{ default_resized.url | safe }}"
10-
srcset="{{ srcset_list | join(sep=", ") | safe }}" />
1+
{% set abspath = "/static/" ~ src %}
2+
{% set meta = get_image_metadata(path=abspath) %}
3+
{% set width = meta.width %}
4+
{% set height = meta.height %}
5+
{% set srcset_list = [] %}
6+
{% for s in config.extra.images_sizes %}
7+
{% if width >= s %}
8+
{% set resized = resize_image(path=abspath, width=s, op="fit_width", format="webp", quality=90) %}
9+
{% set element = resized.url ~ " " ~ s ~ "w" %}
10+
{% set_global srcset_list = srcset_list | concat(with=[element]) %}
11+
{% endif %}
12+
{% endfor %}
13+
{% set default_resized = resize_image(path=abspath, width=config.extra.images_default_size, op="fit_width", format="webp", quality=90) %}
14+
<img
15+
alt="{{ alt }}"
16+
src="{{ default_resized.url | safe }}"
17+
srcset="{{ srcset_list | join(sep=", ") | safe }}"
18+
width="{{ width }}"
19+
height="{{ height }}"
20+
style="aspect-ratio: {{ width }}/{{ height }}; {% if style %}{{ style }}{% endif %}"
21+
class="{% if position %}{{ position }}{% endif %}"
22+
/>

0 commit comments

Comments
 (0)