You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Render {{embed: ((block-uid))}} blocks with their full content (including children) instead of the current placeholder text. Block embeds are one of Roam's key features for reusing content across pages.
Roam web behavior: Block embeds render the referenced block AND all its children inline, in an indented container. The embedded content is editable in-place — edits propagate to the original block.
TUI adaptation: Render embedded blocks read-only with full content (block text + children tree). Editing the embed should navigate to the original block instead of editing in-place (TUI complexity constraint). Visual indicator (border or color) distinguishes embedded content from native blocks.
Implementation hints
Current state
src/markdown.rs:52-62 — parse_embed_inner() extracts the block UID from {{embed: ((uid))}}
Currently renders as: ▸ embed: block text (magenta italic) using the block_ref_cache
Only shows the top-level block text, no children
Data fetching
src/app.rs:84 — block_ref_cache: HashMap<String, String> stores uid → text
Need a richer cache: uid → Block (with children) for embeds
Add embed_cache: HashMap<String, Block> to AppState
Fetch via pull() with a recursive selector: [:block/string :block/uid :block/order :block/open {:block/children ...}]
Spawn async fetch same pattern as spawn_resolve_block_refs
Rendering
src/ui/main_area.rs — add VisibleLine variants for embed content:
Summary
Render
{{embed: ((block-uid))}}blocks with their full content (including children) instead of the current placeholder text. Block embeds are one of Roam's key features for reusing content across pages.Roam web behavior: Block embeds render the referenced block AND all its children inline, in an indented container. The embedded content is editable in-place — edits propagate to the original block.
TUI adaptation: Render embedded blocks read-only with full content (block text + children tree). Editing the embed should navigate to the original block instead of editing in-place (TUI complexity constraint). Visual indicator (border or color) distinguishes embedded content from native blocks.
Implementation hints
Current state
src/markdown.rs:52-62—parse_embed_inner()extracts the block UID from{{embed: ((uid))}}▸ embed: block text(magenta italic) using the block_ref_cacheData fetching
src/app.rs:84—block_ref_cache: HashMap<String, String>stores uid → textBlock(with children) for embedsembed_cache: HashMap<String, Block>toAppStatepull()with a recursive selector:[:block/string :block/uid :block/order :block/open {:block/children ...}]spawn_resolve_block_refsRendering
src/ui/main_area.rs— addVisibleLinevariants for embed content:EmbedStart { depth, block_index }— visual indicator (e.g.,┌─ embed ─)EmbedBlock { depth, text, block_index }— each block in the embedEmbedEnd { depth, block_index }— visual indicator (e.g.,└─────────)Embed rendering in markdown.rs
render_spans_with_refs()should return a signal that this block is an embedflatten_blocks()function inmain_area.rshandles the expansionInteraction
Enter/ion an embedded block could navigate to the original block's page (if page navigation exists, issue Page navigation: follow [[links]] to open pages #1)Edge cases
A embeds B, B embeds A) — detect and break with max depth{{embed: [[Page Name]]}}— page embed, not just block embed. Render page's top-level blocks.Acceptance criteria
{{embed: ((uid))}}renders full block content with children{{embed: [[Page]]}}) also work