Conversation
Previously MarkdownDef used a single MarkdownFilePreview component for all formats, showing only title + plain-text excerpt. Now each format has a purpose-built component: isolated renders full markdown via MarkdownTemplate, embedded shows title + rendered content with fade-out, fitted uses icon + title + excerpt with container queries, and atom shows icon + title inline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52455a9 to
fbd39f3
Compare
…rgin - Add Head format with OG/Twitter meta tags using title and excerpt - Skip duplicate title in Embedded when content starts with matching heading - Add padding to Embedded format - Suppress top margin on first heading in Isolated and Embedded formats Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors MarkdownDef’s presentation formats so markdown files render richer previews across isolated/embedded/fitted/atom contexts, and removes the previously shared preview component.
Changes:
- Replace the single shared
MarkdownFilePreviewwith dedicatedIsolated,Embedded,Fitted,Atom, andHeadcomponents insidemarkdown-file-def.gts. - Render full markdown via
MarkdownTemplatefor isolated/embedded formats (with embedded height clamping + fade mask). - Remove the unused
packages/base/markdown-file-preview.gtscomponent and document a.gtsregex/content-tag parsing gotcha inAGENTS.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/base/markdown-file-preview.gts | Deleted the old shared preview component now replaced by per-format implementations. |
| packages/base/markdown-file-def.gts | Adds per-format components (isolated/embedded/fitted/atom/head), uses MarkdownTemplate, updates excerpt parsing/truncation. |
| AGENTS.md | Documents content-tag lexer pitfalls with certain regex literals in .gts files and recommended workarounds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return markdown.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); | ||
| } | ||
|
|
||
| const FENCED_CODE_RE = /```[\s\S]*?```/g; |
There was a problem hiding this comment.
FENCED_CODE_RE is still a regex literal containing backticks (```), but the new guidance/comment indicates content-tag can misparse backticks in regex literals in .gts files. To avoid reintroducing the same parsing failure, consider defining this via `new RegExp()` (string pattern) as well, or otherwise ensure no backticks appear in regex literals in this file.
| const FENCED_CODE_RE = /```[\s\S]*?```/g; | |
| const FENCED_CODE_RE = new RegExp('```[\\s\\S]*?```', 'g'); |
| class Isolated extends Component<typeof MarkdownDef> { | ||
| get title() { | ||
| return ( | ||
| this.args.model?.title ?? this.args.model?.name ?? 'Untitled markdown' | ||
| ); |
There was a problem hiding this comment.
The title getter logic is duplicated across multiple format components (Isolated/Embedded/Fitted/Atom/Head). This duplication makes it easy for the formats to drift (e.g., changing fallback text in one place but not the others). Consider extracting a shared helper (or a small base class) to compute the title once and reuse it across these components.
| class Isolated extends Component<typeof MarkdownDef> { | |
| get title() { | |
| return ( | |
| this.args.model?.title ?? this.args.model?.name ?? 'Untitled markdown' | |
| ); | |
| function computeMarkdownTitle( | |
| model: { title?: string | null; name?: string | null } | null | undefined, | |
| ): string { | |
| return model?.title ?? model?.name ?? 'Untitled markdown'; | |
| } | |
| class Isolated extends Component<typeof MarkdownDef> { | |
| get title() { | |
| return computeMarkdownTitle(this.args.model); |
backspace
left a comment
There was a problem hiding this comment.
I tried this locally and the previews look good across the different formats, I assume the lack of live updating is an existing problem
the not live updating makes me wonder how the store is handling realm update events for file-defs. perhaps there is a bug there. we def need test coverage around that scenario. |

Summary
MarkdownTemplate(headings, lists, code blocks, tables, syntax highlighting); falls back to title when content is emptymax-height: 200pxand gradient fade-out mask to indicate more contentmarkdown-file-preview.gts(single component previously shared across all formats)Screen.Recording.2026-02-19.at.6.02.29.PM.mov
Test plan
markdown-file-def-test.gtspass unchanged🤖 Generated with Claude Code