Repository navigation
Leave Markdown files to bb's preview in the Monaco plugin - #5054
Merged
SawyerHood merged 1 commit intoOct 6, 2026
Merged
SawyerHood merged 1 commit into
SawyerHood merged 1 commit into
Conversation
The built-in Monaco plugin claimed md and markdown, so Markdown opened in the editor instead of bb's rendered preview. Drop those two extensions from the opener claim. The language map keeps them, so Markdown opened from the Monaco file tree is still highlighted, and mdx stays claimed because bb's preview does not render it. Co-Authored-By: Claude Code <[email protected]>
SawyerHood
marked this pull request as ready for review
October 6, 2026 21:07
SawyerHood
deleted the
bb/can-you-make-the-built-in-monaco-plugin-no-longe-thr_48xu3943an
branch
October 6, 2026 21:07
This was referenced Oct 13, 2026
SawyerHood
pushed a commit
that referenced
this pull request
Oct 13, 2026
## Human comments when i try to open an HTML link, it shows the HTML code, which is annoying sometimes...the PR fixes this to show the rendered preview by default, following the same pattern as for markdown files. https://github.com/user-attachments/assets/6628e44e-1dcc-4b39-b243-e1c4c9a9ce80 - closes #5427 ## What was wrong With File Editor enabled, HTML links opened in Monaco because it claimed `.html` and `.htm`. BB already has a sandboxed HTML viewer with Preview/Raw controls. The viewer also did not recognize `.htm`, and project file previews on the New thread screen did not supply an HTML content URL. ## What changed Leave `.html` and `.htm` to BB's built-in preview, following the existing Markdown exclusion. Recognize `.htm` case-insensitively and pass the existing project file content URL to the shared preview surface. Reuse the existing HTML iframe and Preview/Raw controls without introducing UI components or styling. Update the File Editor documentation. As with Markdown, Monaco is no longer offered for `.html` and `.htm` in Settings → File openers or the Open with menus. Existing HTML-to-Monaco preferences fall back to BB's preview. HTML remains editable from Monaco's own file tree; the built-in Raw view is read-only. This follows [#5054 — Leave Markdown files to BB’s preview in the Monaco plugin](#5054): extend the same default-opener behavior to HTML while reusing the existing viewer. Existing SDK and CLI file-opening paths continue through the shared opener routing; no new API, CLI flag, or daemon wire changes. ## How you verified Regression cases failed before the corresponding fixes and pass after: - Monaco's claimed extensions leave HTML/HTM to BB. - A `.HTM` document renders and switches through the existing Preview/Raw controls. - Project HTML uses the selected host's existing file content route. Checks: - `pnpm exec turbo run lint typecheck test --filter=bb-plugin-monaco-editor` — 47 tests passed. - `pnpm exec turbo run test --filter=@bb/app -- src/components/secondary-panel/FilePreview.test.tsx src/components/secondary-panel/ThreadSecondaryPanelTabContent.markdown-images.test.tsx` — 40 tests passed. - `pnpm exec turbo run lint typecheck --filter=@bb/app --filter=@bb/client-core` — passed, app lint has existing warnings and no errors. - `pnpm exec turbo run test --filter=@bb/client-core -- test/file-preview.test.ts` — 13 tests passed. - `git diff --check` — passed. Live Chromium verification in an isolated source app with File Editor enabled: opened HTML and HTM through the project file picker, clicked the page's JavaScript button, switched Raw → Preview and confirmed its counter state survived, checked Markdown still renders and TypeScript still opens Monaco, and reloaded the HTML preview. HTML responses retained `Content-Security-Policy: sandbox allow-scripts`. No native iOS run. The TypeScript control emitted a Monaco disposal TypeError when switching away; no editor runtime code changed and that separate path was not investigated here. Independent read-only reviews by GPT-6-Astra (xhigh) and Opus 5.5 (high) found no blocking defects. They inspected the source and existing verification evidence; they did not rerun the test suites or browser checks. > AGENT GENERATED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
The built-in Monaco plugin claimed
mdandmarkdownalong with every other extension in its language map, so Markdown files opened in the editor by default instead of bb's rendered preview.What changed
plugins/monaco-editor/lib/languages.ts:CLAIMED_EXTENSIONSnow leaves outmdandmarkdown. The language map still has them, so a Markdown file opened from Monaco's own file tree is still highlighted.mdxstays claimed: bb's preview only renders.mdand.markdown, so.mdxwould otherwise open as plain read-only source.README.mdandPLUGIN_OVERVIEW.mdfor the plugin describe the new behavior.How you verified
plugins/monaco-editor/lib/languages.test.ts, which asserts the claim excludesmdandmarkdown, keepsmdx, and thatlanguageForPathstill maps Markdown paths tomarkdown.pnpm exec turbo run typecheck test --filter=bb-plugin-monaco-editorpasses (5 files, 37 tests).🤖 Generated with Claude Code