Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Empty source paragraphs lose their source identity

クローズ 初心者向け
#2,802 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #2808 @chubes4 による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
css, php
領域
backend

調査の方向性

RichTextElementConverter::convertParagraph() から始めてください。ここでは空の段落が convertText(trim($element->textContent)) ヘルパーに渡され、ソース要素のない core/paragraph が作られます。Issue の HTML で再現し、空の <p> の出力に blocks-engine-source-p-* マーカーが付いているかを確認してください。空のソース段落が、空でない段落と同じようにソース要素から作られ、p ルールとカードごとのマージンルールが適用されるようになれば完了です。

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

説明

Problem

An empty source <p></p> lowers to a bare core/paragraph with no source identity. Its box is still rendered, but author p rules (projected onto the blocks-engine-source-p-* tag marker) can no longer reach it, so it falls back to the UA margins of 1em top and bottom.

Reproduction (neutral)

<style>p{margin-top:0;margin-bottom:1rem}.desc p:empty{min-height:1em}</style>
<main><div class="card"><h3>Title</h3><div class="desc"><p></p></div></div>
<div class="card"><h3>Other</h3><div class="desc"><p>Text</p></div></div></main>

Output: <p></p> and <p class="blocks-engine-source-p-…">Text</p>. The empty paragraph gets no marker, so p{margin-top:0} and the per-card margin rules miss it.

On a real Next.js/Bootstrap capture (nostar2.com video list), each video description is an empty <p>. Every one picks up 32px of UA margin, and the page drifts 32px further per item.

Root cause

RichTextElementConverter::convertParagraph() handles an empty paragraph with convertText(trim($element->textContent)). That helper creates core/paragraph from a text string with no source element, so the source marker, classes and presentation attributes are all dropped.

Expected

An empty source paragraph that is kept as core/paragraph is created from its source element, exactly like a non-empty one, so the author cascade reaches it.


AI disclosure: found and reduced with Claude (Anthropic) in the Pi coding agent during the nostar2.com import parity loop.

主要言語
PHP
スター
22
フォーク
2
平均マージ
7時間 59分
マージ済み PR(30日)
674

環境構築

はじめの一歩

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

Automattic/blocks-engine のほかの issue

Automattic/blocks-engine の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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