Skip to content

Render the FileDef embedding field guide with content-only MarkdownPreview - #6177

Open
lukemelia wants to merge 1 commit into
mainfrom
cs-12589-migrate-filedef-embedding-call-sites
Open

lukemelia wants to merge 1 commit into
mainfrom
cs-12589-migrate-filedef-embedding-call-sites

Conversation

@lukemelia

Copy link
Copy Markdown
Contributor

What

Migrate the FileDef embedding field guide (packages/experiments-realm/filedef-fixtures/file-embedding-field-guide.gts) off the shell-chrome-fighting embed pattern and onto the exported content-only MarkdownPreview.

Before, the guide rendered its markdown body through the FileDef field with @displayContainer={{false}} and then reached into the shell's markup with :deep() to hide the file title and un-clamp the embedded content. It now renders the body directly with MarkdownPreview (from the file-formats/index barrel), and the dead .markdown-embedded* overrides are gone — the renderer emits .markdown-content now, so those selectors matched nothing. The reading-column (.markdown-content) and BFM block-slot (.markdown-bfm-card-slot--block) layout rules are kept, and the leading-H1 dedupe against the masthead is preserved.

The render path is equivalent: the 36 inline ::file[…|embedded] fixtures resolve through the markdown's query-backed linkedFiles/linkedCards, driven by MarkdownTemplate's own field access — the same whether the document arrives via the field shell or as an instance passed to MarkdownPreview.

Audit result

A fresh repo sweep (displayContainer={{false}} occurrences + chrome-hiding :deep() signatures) found this to be the only content-only-FileDef-embedding anti-pattern remaining. Most displayContainer={{false}} hits are plain card/atom renders, unrelated to FileDefs. No additional private renderers needed exporting — the sole target was markdown, and MarkdownPreview was already exported.

Call sites intentionally left on the wrapped/native view (not anti-patterns):

  • experiments-realm/file-links-example.gts<@fields.attachments @format='embedded' /> with no chrome-fighting: a deliberate wrapped embed.
  • base/skill-plus.gts — styles a contains(MarkdownField) render (.markdown-content prose), not a FileDef embed; no chrome hidden.
  • host operator-mode/preview-panel/rendered-markdown.gts, markdown-embed-chooser/*<CardRenderer @displayContainer={{false}}> is the BFM slot renderer's own machinery, not a call site fighting chrome.

Follow-up (out of scope)

  • base/workspace.gts README embed still carries a :deep(.markdown-embedded__content) un-clamp block that is now dead (the class was renamed upstream). It's a legitimately wrapped embed with a collapse/expand toggle; the dead CSS also implies the "Read more" clamp no longer engages — a pre-existing behavior change worth its own ticket rather than folding a behavior fix in here.

Verification

  • ember-template-lint clean.
  • Render-path equivalence established as above.
  • Live visual regression against the filedef-fixtures corpus was not run: the local experiments realm-server was down (unrelated crash), so the card could not be loaded in a browser this session. Worth an eyeball in review/CI that all 36 embeds render with no shell chrome.

Linear: CS-12589

…eview

The guide embedded its markdown body through the FileDef field with @displayContainer={{false}} and reached into the shell markup with :deep() to hide the title and un-clamp the content. Render the body with the exported content-only MarkdownPreview instead, and drop the now-dead .markdown-embedded* overrides (the renderer emits .markdown-content now); keep the reading-column and BFM block-slot layout rules.

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

Claude-Session: https://claude.ai/code/session_014GsYGsuCqHJz9GAti4jheG
@lukemelia
lukemelia requested review from a team and FadhlanR September 17, 2026 18:49
@lukemelia

Copy link
Copy Markdown
Contributor Author

[Claude Code 🤖] Reviewed this in the skills pass across the open PRs: nothing the guidelines mandate, so no push here. It is the change they ask for — the :deep() shell overrides are gone and the content-only component renders directly.

One observation rather than an ask. The two :deep() rules that remain reach into MarkdownContentShell's .markdown-content, which is the same kind of class, in the same renderer, whose rename is what broke the workspace README's collapse. Nothing in the guidelines forbids styling rendered markdown that way, and the reading-column rule has to live somewhere — but the reason it cannot be a class today is that MarkdownPreview declares Element: HTMLElement and never spreads ...attributes, so a class from the embedder is dropped. Adding that to the content-only components (the video renderer just got it) would let this card wrap its own classed element and drop the width rule's :deep(); hiding the duplicate leading h1 would still need one, since that is genuinely reaching into rendered content.

Happy to do that as its own change if you want it — it touches markdown-preview.gts, which is outside this PR's file.

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