Skip to content

Render BFM embeds across the full format × placement matrix#5603

Open
FadhlanR wants to merge 1 commit into
mainfrom
markdown-embedded-card-display-bug
Open

Render BFM embeds across the full format × placement matrix#5603
FadhlanR wants to merge 1 commit into
mainfrom
markdown-embedded-card-display-bug

Conversation

@FadhlanR

Copy link
Copy Markdown
Contributor

Summary

Embedding a card or file in a markdown field only rendered correctly for the default format+placement combos. Notably isolated displayed nothing in either placement, inline embedded collapsed, and several other combos were unverified.

Root cause: across every render surface, a resolved embed slot was only given a sizing style when format === 'fitted'. The isolated and inline embedded default templates lay out at width/height: 100%, which resolves against a shrink-wrapping inline-block (or an unbounded block) and collapses to zero — the instance was in the DOM but invisible.

Change

  • New shared helper bfmResolvedEmbedStyle(format, kind, fittedSizeStyle) in packages/runtime-common/bfm-card-references.ts hands every non-atom resolved embed a definite footprint:
    • inline embedded16rem × 9.375rem
    • inline isolated24rem × 18.75rem
    • block isolated → growable min-height: 18.75rem
    • fitted → its requested dimensions + overflow: hidden
  • Applied in all four render surfaces so footprints stay in lockstep, and the embed-chooser preview (which previously carried its own copy of this logic) now delegates to the helper — no duplicated code:
    • packages/base/default-templates/markdown.gts (saved / isolated / embedded-nested)
    • packages/host/app/components/operator-mode/preview-panel/rendered-markdown.gts (preview panel)
    • packages/host/app/lib/codemirror-context.ts (CodeMirror source editor)
    • packages/host/app/components/markdown-embed-chooser/preview/index.gts (chooser preview)
  • Plain MarkdownField (a StringField) has no relationship to resolve embeds, so its directives stay unresolved by design — documented at the class.

Matrix now covered

For card and file, each of atom / embedded / fitted / isolated, in both inline and block placement (16 combinations).

Tests

  • Unit test for bfmResolvedEmbedStyle.
  • Full card matrix on the saved MarkdownTemplate render path + isolated/embedded footprint assertions (rich-markdown-field-test.gts).
  • Full file matrix in code-mode preview (markdown-file-def-test.gts).
  • Updated/added CodeMirror-editor footprint assertions (codemirror-editor-test.gts).

Verification

ember-tsc (glint) + eslint clean on all changed files. Verified live in the dev stack against experiments/bfm-showcase.md: block isolated now renders the full Author card (name/title/quote/portrait) instead of nothing; inline atom, block embedded, all fitted variants (strip / double-wide-strip / tile / compact-card), and file embeds (inline atom + block embedded image) all render correctly.

🤖 Generated with Claude Code

Embedding a card or file in a markdown field only rendered correctly for
the default format+placement combos. `isolated` collapsed to nothing (its
default template lays out at height: 100%), inline `embedded` collapsed in
a shrink-wrapping inline-block, and non-default combos were unverified.

Add a shared `bfmResolvedEmbedStyle(format, kind, fittedSizeStyle)` helper
that hands every non-atom resolved embed a definite footprint so it can no
longer collapse: inline embedded 16rem×9.375rem, inline isolated
24rem×18.75rem, block isolated a growable `min-height: 18.75rem`, and fitted
its requested dimensions plus `overflow: hidden`. Apply it in all four
render surfaces — the saved MarkdownTemplate, the operator-mode preview
panel, the CodeMirror source editor, and the embed chooser preview (which
previously carried its own copy of this logic) — so footprints stay in
lockstep everywhere.

Plain `MarkdownField` (a StringField) has no relationship to resolve embeds,
so its directives stay unresolved by design; documented at the class.

Cover the full card and file × {atom, embedded, fitted, isolated} ×
{inline, block} matrix on the saved render path, plus a unit test for the
helper and updated CodeMirror-editor footprint assertions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files      1 suites   3h 2m 8s ⏱️
3 663 tests 3 647 ✅ 15 💤 0 ❌ 1 🔥
3 682 runs  3 665 ✅ 15 💤 1 ❌ 1 🔥

Results for commit e716096.

For more details on these errors, see this check.

Realm Server Test Results

    1 files      1 suites   13m 48s ⏱️
1 934 tests 1 934 ✅ 0 💤 0 ❌
2 013 runs  2 013 ✅ 0 💤 0 ❌

Results for commit e716096.

@FadhlanR
FadhlanR marked this pull request as ready for review July 24, 2026 13:05
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