VS Code Markdown Preview Enhanced fixed layout
Install an idempotent local patch for Markdown Preview Enhanced 0.8.30 plus a small VS Code UI switcher. Preserve one Webview across folders; on every Markdown switch, lock the preview group, return the source to the first group, read codexMarkdownPreview.layout, restore a 28%/72% source-to-preview layout, and ignore repair-generated focus events so files cannot enter a switching loop. Horizontal places source left and preview right; vertical places source above and preview below.
Workflow
- Confirm VS Code and
shd101wyy.markdown-preview-enhancedare installed. - Choose and apply a layout:
- Left/right:
python3 scripts/apply_fix.py --layout horizontal - Top/bottom:
python3 scripts/apply_fix.py --layout vertical
- Left/right:
- Reload the VS Code window. Do not merely disable scroll synchronization.
- Open a Markdown source file and invoke Markdown Preview Enhanced once. The script installs these UI controls unless
--skip-uiis passed:- Click the bottom status-bar button
MD:左右orMD:上下to toggle immediately. - Or open the Command Palette (
⌘⇧P) and runMarkdown:切换左右/上下预览布局,Markdown:使用左右预览布局, orMarkdown:使用上下预览布局.
- Click the bottom status-bar button
- Test the failure path: focus or close the right preview, then click another Markdown file. Verify that:
- the source opens in the first group (left or top);
- the second preview (right or bottom) updates automatically;
- the preview group shows a lock icon;
- the source remains at 28% and the preview remains at 72%.
The lock icon means the preview group is already locked. Do not click it; clicking it explicitly unlocks the group.
Safety and compatibility
- The script backs up both modified files once and is safe to run repeatedly.
- The UI switcher saves the selected direction globally; later Markdown switches read that setting instead of reverting to a hard-coded direction.
- Refuse to patch if any code anchor differs; do not guess against a newer bundle.
- The code anchors are validated for Markdown Preview Enhanced 0.8.30. For another version, inspect its
initPreviewimplementation and update the script deliberately. - An extension update or reinstall can overwrite the bundle. Run the skill again after updating.
- Never install or retain a layout-reset helper extension that calls
closeEditorsInGrouporevenEditorWidthson startup.
For another machine, clone or copy this skill folder into ${CODEX_HOME:-$HOME/.codex}/skills/vscode-mpe-fixed-layout, then invoke $vscode-mpe-fixed-layout or run its script directly.