feat(editor): support collapsible <details>/<summary> blocks in issue & comment rendering - #5629
Draft
sapk wants to merge 4 commits into
Draft
feat(editor): support collapsible <details>/<summary> blocks in issue & comment rendering#5629sapk wants to merge 4 commits into
<details>/<summary> blocks in issue & comment rendering#5629sapk wants to merge 4 commits into
Conversation
|
@sapk is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
… descriptions The issue description renders through the Tiptap ContentEditor, which had no node for <details>/<summary>. @tiptap/markdown dropped the tags on both load (flattened display) and save (the block was silently destroyed on any edit). Add a DetailsBlock atom node (modeled on the math / file-card atoms): a block-level markdown tokenizer captures a whole <details><summary>…</summary> …</details> block and stores the summary and inner body markdown verbatim, so renderMarkdown re-emits it unchanged and edits elsewhere round-trip the block. The NodeView renders the body collapsibly through the same ReadonlyContent renderer the autopilot view uses, so a collapsed block looks identical there. Nested <details> is a documented limitation: the tokenizer declines it (the inner </details> would close the outer), falling back to the previous flattened rendering rather than breaking the round-trip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Implements the low-risk robustness suggestions from the code review of the details/summary block: - Tolerate blank lines between <details> and <summary> (regex \n? -> \s*), fixing hand-authored blocks that were previously not recognized. - Guard the `open` flag against false positives inside other attribute values (e.g. class="is open") with a word-boundary-aware pattern. - Decline a body truncated inside a code fence (odd fence count) so a fenced sample containing </details> falls back to flat rendering instead of leaking an unterminated fence. - Add tests covering blank-line tolerance, the `open` false-positive, empty body, consecutive blocks, and the fenced-</details> fallback. Summary markdown-parity in the NodeView is left as a follow-up (needs inline, not block, rendering inside <summary>). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The DetailsBlock node view rendered read-only (contentEditable=false), so users could delete the block but not edit its summary or body. Keep the node an atom (to preserve verbatim <details> round-trip) and, in an editable editor, render an inline summary input and a source-edit body textarea that write back to the node attributes via updateAttributes. Read-only mode still renders the collapsed preview via ReadonlyContent. Adds DOM tests for the editable/read-only node view and model-level edit -> serialize round-trip tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The editable-mode rewrite (6b151e6) swapped the native <details> for an always-expanded form panel, so the block never collapsed on issues (the description editor is always editable). Keep the native <details> chrome in editable mode too: summary <input> inline, body source <textarea> in the expanded region. The fold is local UI state initialized from the open attr — folding/unfolding no longer writes back, so peeking doesn't dirty the doc. Atom + verbatim round-trip unchanged.
sapk
force-pushed
the
agent/details-block
branch
from
July 26, 2026 21:13
78c7fe2 to
be8ed01
Compare
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.
Summary
Adds full support for
<details>/<summary>collapsible HTML blocks in the issue description and comment editor. Previously these blocks rendered flat/expanded on issues (while working correctly in the autopilot view). This PR adds tokenization, rendering, and inline editing for the block.Changes
1.
feat(editor): support collapsible <details>/<summary> blocks in issue and comment renderingdetailsProseMirror node type with HTML tokenization from<details>/<summary>markdownDetailsBlockViewNodeView: collapsed preview in read-only mode (viaReadonlyContent), full markdown rendering with headings, lists, code blocksdetails.cssstyles for the collapsible block2.
refactor(editor): harden details/summary tokenizer per review3.
fix(editor): make details/summary block editable in the editor<input>for the summary and a source-edit<textarea>(raw Markdown) for the bodyupdateAttributes, preserving theopenflagReadonlyContentatomwith Markdown source as the verbatim source of truth, guaranteeing parse → edit → serialize round-trip fidelityFiles changed
packages/views/editor/extensions/details.tsxDetailsBlockViewNodeViewpackages/views/editor/extensions/index.tsdetailsextensionpackages/views/editor/extensions/details.test.tsxpackages/views/editor/extensions/details-view.test.tsxpackages/views/editor/styles/details.csspackages/views/editor/styles/index.cssVerification
pnpm typecheck— pass (all 6 packages)packages/views/editor) — 582 tests passed, including 8 new/updated details testspnpm lint(views) — 0 errors in changed filesBefore / After
Before:

After:

