Add keyboard shortcut to toggle Markdown rendered/raw view (#16413)
Description
Adds a rebindable keyboard shortcut (default
Cmd+E/Ctrl+E) that toggles a Markdown file between the rendered and raw views, as an alternative to clicking the Rendered/Raw control in the pane header.
- The shortcut is gated by a keymap context (
MarkdownDisplayModeToggle) rather than by filtering inside the action handler.FileNotebookViewandCodeVieweach add the context only when the pane shows the Rendered/Raw control, so the binding is not triggerable anywhere else and the keystroke falls through in non-Markdown panes.- Both directions are registered under the same binding name and description (the same pattern as “Save file”), so Settings > Keyboard shortcuts shows a single “Toggle Markdown rendered/raw view” row and rebinding it applies to both views.
- The
CodeViewbinding is behind#[cfg(feature = "local_fs")], matching the existing Rendered/Raw control there.- File-type detection is unchanged.
CodeViewsets the context when its Rendered/Raw control is present, so the shortcut and the control always agree.Linked Issue
Fixes #11786
- The linked issue is labeled
ready-to-specorready-to-implement.- Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).
Testing
New tests:
-
workspace::view::tests::test_markdown_toggle_shortcut_switches_between_raw_and_rendered_panesdispatches the keystroke through the focused editor and its ancestors, the way a real key press is routed, and checks the round trip raw → rendered → raw, and that the keystroke is unhandled in a.rspane. -notebooks::file::tests::test_markdown_toggle_shortcut_only_handled_for_toggleable_fileschecks that the rendered pane only handles the shortcut for files that show the toggle. -util::bindings::tests::test_markdown_display_mode_toggle_is_rebound_in_both_directionschecks that rebinding the shortcut applies to both registrations. -notebooks::file::tests::test_markdown_toggle_shortcut_follows_jupyter_notebook_rendering_flagchecks that the rendered pane handles the shortcut for an.ipynbfile only whenJupyterNotebookRenderingis enabled.The first two fail if the keymap context is not inserted.
./script/presubmitwas run in full on the first commit: format, clippy, clang-format, wgslfmt and shellcheck pass (PSScriptAnalyzer was skipped, I don’t have PowerShell installed). 12,737 of 12,743 tests passed. The 6 failures were 5 SSH integration tests that need access to the GCP test VM, andui_tests::test_cloud_agent_shell_respawn, which passed when re-run on its own. After the later commits I re-ran format,cargo clippy -p warp --all-targets --testsand the related tests, not the full suite.Not covered: the
.ipynbtoggle shares this shortcut behindJupyterNotebookRendering. It is tested from the rendered pane only. There is no test that presses the shortcut in a raw.ipynbpane, and I did not check notebooks manually.
- I have manually tested my changes locally with
./script/runScreenshots / Videos
https://github.com/user-attachments/assets/11d698c4-a41f-4c5d-ac2f-86dfcc3a9f43
Agent Mode
- Warp Agent Mode - This PR was created via Warp’s AI Agent Mode
CHANGELOG-IMPROVEMENT: Added a keyboard shortcut (Cmd+E / Ctrl+E, rebindable) to toggle Markdown files between rendered and raw view.
Co-Authored-By: Claude Code
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Website · Code · Agents · Terminal · Drive · Docs · How Warp Works
About
Warp is an agentic development environment, born out of the terminal. Use Warp’s built-in coding agent, or bring your own CLI agent (Claude Code, Codex, Gemini CLI, and others).
Installation
You can download Warp and read our docs for platform-specific instructions.
Warp Contributions Overview Dashboard
Explore build.warp.dev to:
Automate development with Warp Factories
This repository is driven by Warp Factories: open, flexible infrastructure for teams to build cloud software factories of their own.
Warp Factories are defined in code and easy to deploy on any model or harness, with evals, benchmarks, and self-improvement built in. Get early access or book a demo for a tailored walk-through of the platform. Eligible teams can receive up to $10,000 in free factory usage.
Licensing
Warp’s UI framework (the
warpui_coreandwarpuicrates) are licensed under the MIT license.The rest of the code in this repository is licensed under the AGPL v3.
Open Source & Contributing
Warp’s client codebase is open source and lives in this repository. We welcome community contributions and have designed a lightweight workflow to help new contributors get started. For the full contribution flow, read our CONTRIBUTING.md guide.
Issue to PR
Before filing, search existing issues for your bug or feature request. If nothing exists, file an issue using our templates. Security vulnerabilities should be reported privately as described in CONTRIBUTING.md.
Once filed, a Warp maintainer reviews the issue and may apply a readiness label:
ready-to-specsignals the design is open for contributors to spec out, andready-to-implementsignals the design is settled and code PRs are welcome. Anyone can pick up a labeled issue — mention @oss-maintainers on an issue if you’d like it considered for a readiness label.Building the Repo Locally
To build and run Warp from source:
See AGENTS.md for the full engineering guide, including coding style, testing, and platform-specific notes.
Joining the Team
Interested in joining the team? See our open roles.
Support and Questions
#oss-contributors.Code of Conduct
We ask everyone to be respectful and empathetic. Warp follows the Code of Conduct. To report violations, email warp-coc at warp.dev.
Open Source Dependencies
We’d like to call out a few of the open source dependencies that have helped Warp to get off the ground: