Skip to content

Add full-width and configurable maximum-width rendering #28

Closed

Description

@BinaryOutlook

Stage 3 — Layout and writing preferences

Synopsis

Return visual-editor width control to the user through full-width, default constrained-width, and custom maximum-width choices, while retaining comfortable responsive gutters.

End goal

Users can make the visual editor use their available pane width or select a predictable maximum width without altering the document.

Start after

No prerequisite issue. This work can start independently from freshly fetched origin/main; stage numbering does not require waiting for every earlier milestone. Use the repository's dedicated feature-branch/worktree workflow and record the actual base revision.

Current evidence

The inspected editor stylesheet uses an 860 px outer editor cap with border-box sizing and horizontal padding. That is not equivalent to 860 px of text area. Document the setting's measurement consistently so padding does not silently change its meaning.

Source-inspected baseline: 19b276f3b819b9549e3a9e06d2dc967d8187ec06. Recheck the relevant code on the actual implementation base. No current runtime pass or implementation completion is claimed by this issue.

Agreed scope

  • Use CSS pixels and retain the existing 860 px cap as the initial constrained default.
  • Full width disables the maximum-width constraint but retains usable responsive gutters; it does not mean zero padding.
  • Initially apply these preferences to the visual editor only. Source-mode layout and export paper dimensions remain independent.
  • Keep the initial constrained column centered; alternate alignment and width indicators are separate dependent issues.
  • Persist and apply the preference in both hosts without replacing the live editing document.

Acceptance criteria

  • Full-width, default-width, and custom-width choices behave as documented and survive reopening the editor.
  • Custom widths are validated with a documented valid range/fallback; invalid values cannot produce an unusable editor.
  • The column adapts to viewport/sidebar changes without accidental whole-pane clipping or fixed oversized gutters.
  • Changing width preserves Markdown, selection, caret, scroll/editing context where possible, clean state, and undo.
  • Source mode and HTML/PDF/DOCX/EPUB page-layout settings do not silently inherit this editor-only preference.

Verification

  • Measure layout in narrow/wide panes and with the outline/sidebar opened, closed, and resized; include different font sizes and zoom.
  • Cover paragraphs, code, equations, images, and wide tables, without claiming this setting fixes unrelated content overflow.
  • Test live setting updates and persistence in VS Code and Electron; update all setting catalogs and the editor guide.

Source pointers

  • src/webview/styles.css
  • src/webviewContent.ts
  • src/editorProvider.ts
  • src/shared/settings-provider.ts
  • electron/src/html-generator.ts
  • electron/src/settings-manager.ts
  • package.json

Related work

Related: #16 owns broader rendering and spacing work. Coordinate common layout measurements and padding, but do not absorb parser/blank-line standardization into this width preference.

Delivery contract

Implement the shared editor behavior in both VS Code and Electron. View-only settings/actions must preserve Markdown, selection/editing context, clean state, and undo history. For new or changed settings, keep host wiring, manifest descriptions, all supported translations, and documentation consistent. Preserve existing identifiers and defaults except for the deliberate changes specified above.

Work from the repository root using the Node version in .node-version and the maintained instructions in CONTRIBUTING.md, docs/building.md, and docs/testing/README.md; export changes also follow docs/export-verification.md. Run full compilation after webview JavaScript/CSS, shared-module, or translation changes, plus checks that exercise the changed behavior. Rebuild and reinstall for installed-extension evidence. Report failures/skips honestly; follow required CI and review gates. Update affected documentation and review any committed Markdown in source and rendered form.

Link the PR or investigation to this issue. Keep remediation on the same focused work item where practical. Completion requires the stated evidence and accepted outcome; opening a draft PR does not complete the issue. No deadline or assignee is imposed by this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions