Make the width of Markdown images configurable (fixed at 760px)

オープン 初心者向け
#3,355 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
html, hugo
領域
content

調査の方向性

modules/blox/layouts/_markup/render-image.html の 45-52 行を読み、 img タグの sizes および Fit size が 760 に固定されている箇所を確認せよ。サイトパラメータ hugoblox.content.image_width をデフォルト 760 で追加し、そこでそれを使用し、さらに最大の srcset 候補を引き上げる。Done は、既存のサイトを変更せずに画像が設定幅に従うことを意味する。

索引モデルが issue の本文から書いたものです。

説明

Prerequisites
  • I have searched for duplicate or closed feature requests
  • I am mindful of the project scope
Proposal

Make the display width of Markdown images configurable, instead of the fixed 760px in modules/blox/layouts/_markup/render-image.html:

{{- $img_md := $img.Fit "760x760 webp" -}}
...
sizes="(max-width: 480px) 100vw, (max-width: 768px) 90vw, (max-width: 1024px) 80vw, 760px"

For example, a site parameter that sets both the Fit size and the last sizes value, defaulting to 760 so nothing changes for existing sites:

hugoblox:
  content:
    image_width: 896

It would also help if the largest srcset candidate went up to twice that width (or the original width, whichever is smaller), so images stay sharp on high-density screens.

Motivation and context

On my blog the article column is 896px wide, so every Markdown image (mostly screenshots of profiler output and code) is 136px narrower than the text around it, and small text in the screenshots is harder to read than it needs to be.

Today the only way to change this is to copy the whole render-image.html into the site and edit two lines, then keep that copy in step with every theme update. The template also declares $max_width, $width and $height but always sets them to "", so there is no hook for this either.

主要言語
HTML
スター
9.8k
フォーク
2.9k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

HugoBlox/kit のほかの issue

HugoBlox/kit の issue をすべて見る

似ている issue

Content の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。