custom keybinding documentation!

This commit is contained in:
Tommaso Sciortino
2026-03-10 21:32:20 -07:00
parent e54c450bc1
commit a92ce848e1
4 changed files with 153 additions and 99 deletions

View File

@@ -27,6 +27,7 @@ const OUTPUT_RELATIVE_PATH = ['docs', 'reference', 'keyboard-shortcuts.md'];
import { formatKeyBinding } from '../packages/cli/src/ui/key/keybindingUtils.js';
export interface KeybindingDocCommand {
command: string;
description: string;
bindings: readonly KeyBinding[];
}
@@ -81,6 +82,7 @@ export function buildDefaultDocSections(): readonly KeybindingDocSection[] {
return commandCategories.map((category) => ({
title: category.title,
commands: category.commands.map((command) => ({
command: command,
description: commandDescriptions[command],
bindings: defaultKeyBindingConfig.get(command) ?? [],
})),
@@ -94,14 +96,14 @@ export function renderDocumentation(
const rows = section.commands.map((command) => {
const formattedBindings = formatBindings(command.bindings);
const keysCell = formattedBindings.join('<br />');
return `| ${command.description} | ${keysCell} |`;
return `| \`${command.command}\` | ${command.description} | ${keysCell} |`;
});
return [
`#### ${section.title}`,
'',
'| Action | Keys |',
'| --- | --- |',
'| Command | Action | Keys |',
'| --- | --- | --- |',
...rows,
].join('\n');
});