Skip to content

Never strip HTML when saving Docs - #5443

Merged
brsbl merged 1 commit into
bb/docs-raw-html-1-preserve-sourcefrom
bb/docs-raw-html-2-blocks
Oct 14, 2026
Merged

brsbl merged 1 commit into
bb/docs-raw-html-1-preserve-sourcefrom
bb/docs-raw-html-2-blocks

Conversation

@brsbl

@brsbl brsbl commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

Credit: @alanagoyal found and diagnosed this bug, wrote the first fix in #5306, and wrote the video regression test this PR keeps. Her commit is the base of this stack (#5442).

What was wrong

Docs loads Markdown into Tiptap, which discards HTML it has no schema rule for, then rewrites the whole file from that document on every save. Editing one sentence therefore deleted unrelated HTML, such as the video embed reported in #5306.

What changed

  • Blocks the user does not edit are saved byte for byte.
  • Only edited blocks are re-serialized; reference definitions and other text between blocks are always kept.
  • Inline <strong>, <em>, <a href>, and <br> still render as formatting, as on main.
  • Other HTML, including tags the user types, shows as editable text and is saved unescaped.
  • Tags with extra attributes or no matching partner stay as editable text, so nothing is stripped.
  • HTML blocks are editable text saved exactly as typed, replacing the locked placeholders from Preserve HTML embeds when editing Docs #5442.
  • Stacked on Preserve HTML embeds when editing Docs #5442. No Plugin SDK, CLI, or wire changes; the Docs README is updated.

How you verified

  • Remote CI passed on 136c4a34e except the plugin SDK npm version check.
  • That check fails on main's unbumped provider-bridge-testing.js, which this PR does not touch.
  • Browser QA on 584272025 (Chrome for Testing 155) passed six steps with no console errors.
  • In that pass, editing elsewhere kept the file byte for byte, and typed <kbd> saved as HTML.
  • Tests cover byte-exact saves, edits, deletes, inserts, reference definitions, line endings, attributes, typed tags, and task lists.
  • @alanagoyal's regression test from Preserve HTML embeds when editing Docs #5306 checks that her blog's video embed survives an unrelated autosave.
Known limitations
  • Undoing an edit re-saves that block in normalized Markdown.
  • Multi-line HTML at the start of a list item collapses to one line when that list is edited.
  • The Tasks editor still drops unsupported HTML.

BB-Thread-ID: thr_fashr87x6y

Screenshots

Docs editor after editing one paragraph and saving. Before is main; after is this PR.

Example Before After
Blog
Readme
Escapes

🤖 Generated with Claude Code

AGENT GENERATED

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T18:43:30.944246Z 35db91d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@brsbl
brsbl added this pull request to stack #5445 October 13, 2026 18:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35db91df48

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/docs/raw-html.ts Resolved
@brsbl
brsbl force-pushed the bb/docs-raw-html-2-blocks branch from 6304f48 to fac9bea Compare October 13, 2026 19:01
@brsbl
brsbl force-pushed the bb/docs-raw-html-2-blocks branch from fac9bea to 2c6d554 Compare October 13, 2026 19:31
@brsbl brsbl changed the title Show HTML blocks in Docs as normal content or editable source Never strip HTML when saving Docs Oct 14, 2026
@brsbl
brsbl force-pushed the bb/docs-raw-html-2-blocks branch from 2c6d554 to 9bc9cf2 Compare October 14, 2026 16:47
@brsbl
brsbl force-pushed the bb/docs-raw-html-2-blocks branch from 9bc9cf2 to 5842720 Compare October 14, 2026 16:52
@brsbl
brsbl force-pushed the bb/docs-raw-html-2-blocks branch from 136c4a3 to e1f4569 Compare October 14, 2026 17:45
Docs loaded Markdown into Tiptap, which discards HTML it has no schema
rule for, then rewrote the whole file from that document on every save,
so editing one sentence deleted unrelated HTML. Docs now saves blocks the
user does not edit byte for byte and re-serializes only edited blocks.
Inline tags Docs already renders keep rendering; other HTML, including
tags the user types, stays as editable text saved unescaped, and HTML
blocks are editable text saved exactly as typed.

Co-authored-by: alanagoyal <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brsbl
brsbl force-pushed the bb/docs-raw-html-2-blocks branch from e61b497 to 9afbb91 Compare October 14, 2026 18:01
@brsbl
brsbl merged commit 522255c into main Oct 14, 2026
23 checks passed
@brsbl
brsbl deleted the bb/docs-raw-html-2-blocks branch October 14, 2026 18:05
brsbl added a commit that referenced this pull request Oct 15, 2026
…ar drawer (#5495)

## Human comments

## What was wrong

In macOS desktop windows narrower than 768px, New thread in the sidebar
drawer sits under the traffic lights, and the sidebar toggle draws on
top of it (reported on Discord after desktop-v0.46.0). #5229
(`ff9484883`) moved the navigation rail into the compact drawer and
dropped the macOS start inset from `SidebarTopReserveRow`. The drawer's
header row now starts right after the rail, at x=52. That is under the
lights (x=18–78), and the sidebar toggle, fixed at x=84–112, overlaps
it.

## What changed

- `SidebarTopReserveRow`
(`apps/app/src/components/sidebar/SidebarChrome.tsx`) pads the drawer's
header row so New thread starts at x=116, just after the sidebar toggle.
That is where it sat in 0.45.0.
- The padding applies only on macOS desktop, in the compact drawer (not
the framed sidebar), and outside full screen, where there are no traffic
lights.
- Wide framed windows, browsers and other platforms are unchanged. No
wire, CLI or contract changes.

## How you verified

- New `SidebarChrome.test.tsx`: the compact macOS drawer reserves the
space, while the framed window and a compact browser window don't. CI
failed with only the test ([run
38601538235](https://github.com/get-bb/bb/actions/runs/38601538235),
app-8: "expected false to be true") and passes with the fix.
- Real Mac (macOS 26.5.2), using the Electron desktop dev app built from
`main` (before) and from this branch (after), with the same seeded
thread. The window was resized natively to 700×800 with the sidebar
drawer open, and to 1100×800.
- **700px:** New thread moves from x=52–287, under the lights and the
toggle, to x=116–287. The hit test at its center returns New thread.
  - **1100px:** the framed layout is identical before and after.
- The colored dots are stand-ins drawn at the traffic lights' native
position (18, 18). The native buttons can't be captured without Screen
Recording permission.
- Not covered: a narrow window in native full screen, where the padding
is off by design because there are no lights.
- Remote CI runs the tests; nothing was run locally.
- CI: every job passes except the plugin SDK npm version guard in
Checks. Plugin Fork Check was skipped by change-based selection. The
guard fails because `@get-bb/[email protected]` was published to npm at
15:11 UTC today, and building the SDK from `main` now produces a
different `dist/provider-bridge-testing.js`. This PR doesn't touch the
SDK. Every PR based on current `main` without a version bump fails the
same way (for example #5490 and #5443), and #5492 passes because it
bumps to 0.6.44. It clears once a bump lands on `main` and this PR's CI
reruns.

| Screen / state | Viewport | Before | After |
| --- | --- | --- | --- |
| Thread · sidebar drawer open (zoom) | macOS desktop · 700×800 |
![Before 700
zoom](https://github.com/user-attachments/assets/1f708c7d-f2aa-42ee-aa2d-c5043d2468ed)
| ![After 700
zoom](https://github.com/user-attachments/assets/793b9443-c4e1-463f-a2e6-31c785b87891)
|
| Thread · sidebar drawer open | macOS desktop · 700×800 | ![Before
700](https://github.com/user-attachments/assets/379ba908-be84-4d51-aa75-654ff175ff77)
| ![After
700](https://github.com/user-attachments/assets/ffa9aebd-8e67-4d79-b9db-c46057e63433)
|
| Thread · framed sidebar (unchanged) | macOS desktop · 1100×800 |
![Before
1100](https://github.com/user-attachments/assets/a77833bb-81f7-4b5f-9546-fd5fb4a0c6b7)
| ![After
1100](https://github.com/user-attachments/assets/1327b504-d9f3-4e91-8706-a83257371042)
|

### Merge order with "Compact the macOS app frame and move headers into
the title bar" (#5529)

Resolved: the PRs can merge in either order. #5495 used to pad the
narrow-window drawer header with a literal `88px`, which assumed the
sidebar toggle sits at the 84px reserve; with #5529's wider reserve New
thread would have started under the toggle (measured at an earlier 88px
reserve: New thread at x=112 under the toggle at x=88–116). #5495 now
includes `5bd8c8b85`, which derives that padding from
`--bb-macos-traffic-light-reserve` (falling back to 84px), so New thread
starts 4px after the toggle under either geometry. Measured on a real
Mac at 700px:

| Build | Sidebar toggle | New thread |
| --- | --- | --- |
| #5495 head `5bd8c8b85` on main | x=84–112 | x=116 |
| #5529 head `96084fc15` + #5495 | x=87–115 | x=119 |

BB-Thread-ID: thr_eigbyjruhs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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