Skip to content

refactor(cli): unify block tree on HMBlockNode, fix markdown images#403

Open
juligasa wants to merge 3 commits intomainfrom
refactor/cli-unify-hmblocknode
Open

refactor(cli): unify block tree on HMBlockNode, fix markdown images#403
juligasa wants to merge 3 commits intomainfrom
refactor/cli-unify-hmblocknode

Conversation

@juligasa
Copy link
Copy Markdown
Collaborator

@juligasa juligasa commented Mar 26, 2026

Summary

  • Replaces BlockNode with HMBlockNode in the diff engine and CLI pipeline, eliminating the parallel type system and bidirectional converters
  • Fixes markdown images with local file paths (![alt](/path/to/img.png)) — they now resolve to IPFS automatically, same as JSON input
  • Removes hmBlockNodeToBlockNode and replaces flattenToOperations with hmBlockNodesToOperations

…solution

Replace BlockNode with HMBlockNode throughout the diff engine and CLI
pipeline. This eliminates the parallel type system and the bidirectional
converters (hmBlockNodeToBlockNode, markdownBlockNodesToHMBlockNodes at
call sites).

- block-diff.ts: computeReplaceOps, matchBlockIds, isBlockContentEqual
  now accept HMBlockNode directly; removed hmBlockNodeToBlockNode
- markdown-to-blocks.ts: parseMarkdown now returns HMBlockNode[] by
  calling markdownBlockNodesToHMBlockNodes internally
- document.ts: markdown path now resolves file:// image links to IPFS
  via resolveFileLinks (previously only worked for JSON input)
- Removed flattenToOperations usage in favor of hmBlockNodesToOperations
- Updated all tests to use HMBlockNode format

Fixes: markdown images with local file paths (![alt](/path/to/img.png))
are now uploaded to IPFS and rendered correctly when published.
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