Skip to content

feat(editor): add Markdown formatting shortcuts - #6258

Merged
boojack merged 1 commit into
mainfrom
feat/editor-markdown-shortcuts
Sep 1, 2026
Merged

feat(editor): add Markdown formatting shortcuts#6258
boojack merged 1 commit into
mainfrom
feat/editor-markdown-shortcuts

Conversation

@johnnyjoygh

Copy link
Copy Markdown
Contributor

Summary

  • add familiar cross-platform Markdown formatting shortcuts to the CodeMirror 6 editor
  • reuse the toolbar formatting dispatcher for marks, code, headings, paragraph text, and lists
  • prioritize formatting bindings so Mod-I applies italic instead of CodeMirror default behavior
  • document the shortcuts and add keyboard coverage

Test plan

  • cd web && pnpm lint
  • cd web && pnpm test
  • git diff --check

Closes #6253.

Supersedes #6254 and #6255; those competing PRs can be closed in favor of this implementation.

@johnnyjoygh
johnnyjoygh requested a review from a team as a code owner September 1, 2026 13:52
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 407f9135-54f7-4fd2-b0b6-cfb72b12811f

📥 Commits

Reviewing files that changed from the base of the PR and between ee3a0a2 and 2b01137.

📒 Files selected for processing (4)
  • web/src/components/MemoEditor/Editor/extensions.ts
  • web/src/components/MemoEditor/Editor/formatting.ts
  • web/src/components/MemoEditor/README.md
  • web/tests/editor-keys.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

Added keyboard shortcuts for inline formatting, code blocks, paragraphs, headings, ordered lists, bullet lists, and task lists. Extracted formatting command dispatch into the exported runFormattingCommand function. Registered formatting bindings before CodeMirror defaults. Updated autocomplete precedence documentation. Added documentation and tests for shortcut behavior and keymap precedence.

Suggested reviewers: bluedbird, boojack

Merge Risk: ⚪ Minimal · up to 2b011

This change adds localized Markdown keyboard shortcuts to the editor and reuses the existing formatting path. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: adding Markdown formatting shortcuts to the editor.
Description check ✅ Passed The description directly covers the shortcut implementation, dispatcher reuse, keymap priority, documentation, and tests.
Linked Issues check ✅ Passed The changes satisfy issue #6253 by adding keyboard shortcuts for Markdown formatting, including marks, code, headings, paragraphs, and lists, with cross-platform modifier handling.
Out of Scope Changes check ✅ Passed The code, documentation, refactoring, and tests directly support the linked issue and stated objectives. No unrelated changes are identified.
Full details: Docstring Coverage

Explanation

Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds cross-platform Markdown formatting shortcuts to the CodeMirror editor by extracting and reusing the toolbar’s formatting dispatcher.

  • Adds bindings for inline marks, code, headings, paragraph text, and list modes.
  • Prioritizes formatting bindings over CodeMirror defaults.
  • Documents the shortcuts and adds keyboard-driven coverage.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The dispatcher refactor preserves existing toolbar behavior, and the new keymap routes each documented shortcut through that same live-editor formatting path with regression coverage.

Important Files Changed

Filename Overview
web/src/components/MemoEditor/Editor/extensions.ts Adds prioritized formatting key bindings that delegate to the shared formatting command implementation.
web/src/components/MemoEditor/Editor/formatting.ts Extracts the existing toolbar command dispatch logic into a reusable function without changing command behavior.
web/tests/editor-keys.test.ts Adds end-to-end keyboard coverage for every new formatting shortcut and the Mod-I precedence case.
web/src/components/MemoEditor/README.md Documents the new editor formatting shortcuts and their keymap precedence.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant K as CodeMirror keymap
    participant F as Formatting dispatcher
    participant D as Markdown document
    participant S as Editor state
    U->>K: Press formatting shortcut
    K->>F: runFormattingCommand(view, command)
    F->>D: Apply Markdown edit
    D->>S: Emit document update
    S-->>U: Refresh editor and toolbar state
Loading

Reviews (1): Last reviewed commit: "feat(editor): add Markdown formatting sh..." | Re-trigger Greptile

@boojack
boojack merged commit 673b9df into main Sep 1, 2026
3 of 4 checks passed
@boojack
boojack deleted the feat/editor-markdown-shortcuts branch September 1, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add markdown formatting keyboard shortcuts

2 participants