Skip to content

Render bullet lists as proper ProseMirror nodes in from_markdown()#35

Open
yf-chau wants to merge 2 commits intoma2za:mainfrom
yf-chau:fix/parse-inline-and-bullet-lists
Open

Render bullet lists as proper ProseMirror nodes in from_markdown()#35
yf-chau wants to merge 2 commits intoma2za:mainfrom
yf-chau:fix/parse-inline-and-bullet-lists

Conversation

@yf-chau
Copy link

@yf-chau yf-chau commented Feb 27, 2026

Summary

from_markdown() strips bullet markers (* / -) but emits each item as an independent paragraph node instead of a bullet_list containing list_item children. 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"}]}

Before — list items render as plain text paragraphs

After (this PR)

Consecutive bullets are grouped into a proper bullet_list node, 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"}]}]}
  ]
}

After — list items render as a proper bulleted list

Non-bullet lines and blank lines flush the pending list, so mixed content (paragraphs interspersed with lists) works correctly.

🤖 Generated with Claude Code

@yf-chau yf-chau marked this pull request as draft February 27, 2026 03:47
@yf-chau yf-chau closed this Feb 27, 2026
@yf-chau yf-chau reopened this Feb 27, 2026
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>
@yf-chau yf-chau force-pushed the fix/parse-inline-and-bullet-lists branch from 1c994c6 to 7191ff1 Compare February 27, 2026 03:51
@yf-chau yf-chau changed the title Fix parse_inline dropping links at position 0; render bullet lists as ProseMirror nodes Render bullet lists as proper ProseMirror nodes in from_markdown() Feb 27, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yf-chau yf-chau force-pushed the fix/parse-inline-and-bullet-lists branch from 530606c to 239e93d Compare February 27, 2026 04:05
@yf-chau yf-chau marked this pull request as ready for review February 27, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant