Render bullet lists as proper ProseMirror nodes in from_markdown()#35
Open
yf-chau wants to merge 2 commits intoma2za:mainfrom
Open
Render bullet lists as proper ProseMirror nodes in from_markdown()#35yf-chau wants to merge 2 commits intoma2za:mainfrom
yf-chau wants to merge 2 commits intoma2za:mainfrom
Conversation
from_markdown() stripped bullet markers (* / -) but emitted each item as an independent paragraph node. Substack's ProseMirror editor expects a single bullet_list node wrapping list_item children. Without this structure, bullet lists render as disconnected paragraphs in the published post. Consecutive bullet lines are now accumulated and flushed as a single bullet_list node with proper list_item > paragraph nesting. Non-bullet lines and blank lines flush the pending list, so mixed content works correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1c994c6 to
7191ff1
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
530606c to
239e93d
Compare
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.
Summary
from_markdown()strips bullet markers (*/-) but emits each item as an independentparagraphnode instead of abullet_listcontaininglist_itemchildren. This means<li>tags are rendered as plain text paragraphs rather than as a formatted list on Substack.Before (current behavior)
Each bullet becomes a flat paragraph —
<li>elements are lost:{"type": "paragraph", "content": [{"type": "text", "text": "Item 1"}]}, {"type": "paragraph", "content": [{"type": "text", "text": "Item 2"}]}, {"type": "paragraph", "content": [{"type": "text", "text": "Item 3"}]}After (this PR)
Consecutive bullets are grouped into a proper
bullet_listnode, producing correct<ul><li>markup:{ "type": "bullet_list", "content": [ {"type": "list_item", "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Item 1"}]}]}, {"type": "list_item", "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Item 2"}]}]}, {"type": "list_item", "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Item 3"}]}]} ] }Non-bullet lines and blank lines flush the pending list, so mixed content (paragraphs interspersed with lists) works correctly.
🤖 Generated with Claude Code