fix: リストアイテムを <p> でラップして note.com の正規化後もテキストを保持する#1
Open
suwa-sh wants to merge 1 commit intoshimayuz:mainfrom
Open
fix: リストアイテムを <p> でラップして note.com の正規化後もテキストを保持する#1suwa-sh wants to merge 1 commit intoshimayuz:mainfrom
suwa-sh wants to merge 1 commit intoshimayuz:mainfrom
Conversation
note.com's editor block parser normalizes <li>text</li> to <li><p name="UUID" id="UUID"></p></li>, discarding the inner text. The published preview shows empty bullets even though the API call returns success and get-note reflects the inbound HTML body intact. Wrapping each list item's content in a <p> tag matches the structure note.com keeps after normalization, so addUUIDAttributes assigns the required name/id to the <p> and the text is preserved through the block parser. Verified by re-submitting drafts containing markdown lists; preview HTML now contains <li><p name="UUID">text</p></li> and the rendered article shows bullet text correctly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
convertMarkdownToNoteHtmlは<li>${item}</li>を出力していますが、note.com の editor ブロックパーサはこれを<li><p name=\"UUID\" id=\"UUID\"></p></li>に正規化する際に内部テキストを捨ててしまいます。API 呼び出しは success を返し、get-noteも投稿した HTML body をそのまま返すのに、公開プレビューでは bullet だけが表示されてテキストが空になります。各リストアイテムの中身を
<p>でラップする(<li><p>${item}</p></li>)ことで、note.com 正規化後の構造と一致させ、addUUIDAttributesが<p>にname/idを付与してブロックパーサがテキストを保持できるようにします。再現(修正前)
markdown リストを含む下書きを投稿し、プレビュー URL を開くと bullet は描画されるが中身のテキストが空になります。
get-noteは<li>text</li>(送信した body)を返す<li><p name=\"UUID\" id=\"UUID\"></p></li>get-noteの結果だけを見る検証ではこのバグに気づけません。修正後
convertMarkdownToNoteHtmlが<li><p>${item}</p></li>を出力するようになり、後段のaddUUIDAttributesが<p>にname/idを付与することで note.com が期待する構造になります。複数の下書きで再投稿して検証済み — プレビュー HTML には<li><p name=\"UUID\">text</p></li>が含まれ、レンダリング後の記事でも bullet のテキストが正しく表示されることを確認しました。変更内容
src/utils/markdown-converter.tsの 11 箇所(リストを flush している全ての箇所)で<li>${item}</li>→<li><p>${item}</p></li>。補足
🤖 Generated with Claude Code