feat: details/summary collapsible blocks, line numbers, thematicBreak width#12
Open
skyth-engine wants to merge 1 commit into
Open
feat: details/summary collapsible blocks, line numbers, thematicBreak width#12skyth-engine wants to merge 1 commit into
skyth-engine wants to merge 1 commit into
Conversation
92ec047 to
bea3946
Compare
… width
- Add remarkMergeBlockHtml plugin: merges block-level <details>...</details>
sequences (remark type-6 HTML nodes) into htmlBlock nodes so they render
as interactive components instead of raw text
- New DetailsBlock (src/nodes/details.tsx): click-to-toggle with useState,
extracts summaryText from opening html chunk (block path) or summary child
node (inline path), falls back to 'Details' label
- Add CodeOptions interface: lineNumbers (bool | {minLines}) and maxHeight;
exported from index.tsx and threaded through Walk → BlockNode → CodeBlock
and all recursive call sites (ListItemNode, DefListBlock, DetailsBlock)
- Line numbers: gutter scales with log10(lineCount), auto-shows on blocks
>= minLines (default 6), opt-in via codeOptions.lineNumbers
- maxHeight replaces hardcoded MAX_CODE_BLOCK_HEIGHT; getBlockMetrics in
block-metrics.ts updated to accept optional third param
- thematicBreak uses process.stdout.columns instead of hardcoded 40
- Fix open.ts: remove unclosed async commandExists wrapper, add missing
commandExistsCache declaration, restore terminal variable assignment
and guard in openWithTerminalEditor, keep injection-safe args and
xfce4-terminal --command fix from PRs #10/#11
- Update assets/markdown-test.md with details/summary section and
line numbers demo; update test-render.tsx to pass codeOptions
bea3946 to
b282be0
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
Re-applies the feature set from #1 against the updated main, plus fixes Jules’ broken
open.ts.Bug fix:
open.ts(Jules’ mess)Two PRs (#10, #11) conflicted and left the file broken:
async function commandExistswas never closed — wrapped the new cached version inside an unclosed bodycommandExistsCachewas referenced but never declaredopenWithTerminalEditorwas missingterminalassignment and guard, with duplicateconst argsblocksFix: rewrite both functions cleanly, keeping the cache (#10), injection-safe args and xfce4
--commandfix (#11).Features
<details>/<summary>collapsible blocksNew
remarkMergeBlockHtmlplugin merges block-level<details>...</details>sequences intohtmlBlocknodes.remarkMergeInlineHtmlonly handled inline HTML — block-level<details>was landing as rawhtmlnodes and rendering as muted text. NewDetailsBlockcomponent handles both paths.Line numbers + configurable
maxHeightviacodeOptionsLine numbers auto-show on blocks ≥
minLines(default 6). Gutter width scales withMath.floor(log10(lineCount) + 1).maxHeightreplaces the hardcodedMAX_CODE_BLOCK_HEIGHT = 18constant via the updatedgetBlockMetricssignature. Both props threaded through all recursive call sites.thematicBreakuses terminal width─.repeat(40)→process.stdout.columns - 2`.Test
Pre-existing
refractorandimage-dimensionsmissing@typeserrors only. All new code typechecks clean.