mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
* docs: new help built with vitepress. * docs: improve docs home ui Added a Go to Docs button on homepage Added a searchbar for directly searching what you are looking for in the docs * docs(help): wire up with build system & setup proper ci * Clean up new documentation (#10174) * Docs: Cleanup pass 1 Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> * docs: cleanup pass 2 Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> * docs: Fix vscode's manglement that I missed. Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> * Update docs/help/contents/plans-and-limits.md Co-authored-by: Abdullah Atta <thecodrr@protonmail.com> Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> * Update docs/help/contents/rich-text-editor/outline-lists.md Co-authored-by: Abdullah Atta <thecodrr@protonmail.com> Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> * docs: Remove self-hosting guide from sidebar, and comments for reviewer. Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> --------- Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> Co-authored-by: Abdullah Atta <thecodrr@protonmail.com> * docs: some fixes * ci: do not publish help on push * docs(help): improve regional pricing & free trials * docs: improve sidebar * docs: some more fixes after re-review * docs: improve search and nav * docs: a few more fixes * docs: fix tabs formatting compat with prettier * docs: fix tabs formatting in various places * docs: show correct plus button image for mobile * docs: disable notesnook self hosting docs * docs: update help docs with fixes --------- Signed-off-by: Chloe Oletto <NeedsChloesure@riseup.net> Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co> Co-authored-by: Chloe Oletto <NeedsChloesure@riseup.net> Co-authored-by: Abdullah Atta <thecodrr@protonmail.com>
118 lines
4.2 KiB
JavaScript
118 lines
4.2 KiB
JavaScript
/*
|
|
This file is part of the Notesnook project (https://notesnook.com/)
|
|
|
|
Copyright (C) 2023 Streetwriters (Private) Limited
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import { writeFileSync } from "fs";
|
|
import {
|
|
getGroupedKeybindings,
|
|
formatKey,
|
|
macify,
|
|
CATEGORIES
|
|
} from "@notesnook/common";
|
|
|
|
console.log("Generating keyboard shortcuts documentation...");
|
|
|
|
const keyboardShortcutFilePath = "./contents/keyboard-shortcuts.md";
|
|
|
|
const frontmatter = `---
|
|
title: Keyboard shortcuts
|
|
pageTitle: Every keyboard shortcut in Notesnook
|
|
description: The complete list of Notesnook keyboard shortcuts for web, Windows, Linux and macOS — navigation, the editor, formatting and note actions.
|
|
keywords:
|
|
- notesnook keyboard shortcuts
|
|
- notesnook hotkeys
|
|
- notes app shortcuts
|
|
---
|
|
`;
|
|
|
|
const content = `# Keyboard shortcuts
|
|
|
|
These are every keyboard shortcut the Notesnook desktop and web apps respond to, grouped by what they do. Press \`Ctrl\` \`/\` (\`⌘\` \`/\` on macOS) inside the app to bring the same list up there.
|
|
|
|
::: info This page is generated from the app
|
|
The tables below are generated straight from the app's own keybinding registry, so they cannot drift out of step with the shortcuts that actually fire.
|
|
:::`;
|
|
|
|
const relatedPages = `## Related pages
|
|
|
|
- [Editor toolbar](/rich-text-editor/rich-text-editor-toolbar) — the same actions as buttons, and how to rearrange them
|
|
- [Markdown shortcuts](/rich-text-editor/markdown-notes-editing) — formatting that triggers as you type
|
|
- [Find & replace](/rich-text-editor/search-and-replace) — searching inside the note you are editing
|
|
- [Search & navigation](/search-and-navigation) — the command palette and quick open
|
|
- [Tabs & panes](/rich-text-editor/editor-tabs-and-panes) — moving between open notes`;
|
|
|
|
const markdownTable = getGroupedTableKeybindingsMarkdown();
|
|
|
|
writeFileSync(
|
|
keyboardShortcutFilePath,
|
|
frontmatter + "\n" + content + "\n\n" + markdownTable + "\n\n" + relatedPages + "\n",
|
|
"utf-8"
|
|
);
|
|
|
|
console.log("Keyboard shortcuts documentation updated successfully!");
|
|
|
|
/**
|
|
* @returns markdown formatted table of keyboard shortcuts grouped by category.
|
|
*/
|
|
function getGroupedTableKeybindingsMarkdown() {
|
|
const desktopKeybindings = getGroupedKeybindings(true, false);
|
|
const webKeybindings = getGroupedKeybindings(false, false);
|
|
|
|
const header = `| Description | Web | Windows/Linux | Mac |
|
|
| --- | --- | --- | --- |`;
|
|
|
|
return CATEGORIES.map((category) => {
|
|
const webShortcuts =
|
|
webKeybindings.find((g) => g.category === category)?.shortcuts || [];
|
|
const desktopShortcuts =
|
|
desktopKeybindings.find((g) => g.category === category)?.shortcuts || [];
|
|
|
|
const mergedShortcuts = {};
|
|
|
|
webShortcuts.forEach(({ description, keys }) => {
|
|
if (!mergedShortcuts[description]) {
|
|
mergedShortcuts[description] = {};
|
|
}
|
|
mergedShortcuts[description].web = keys;
|
|
});
|
|
desktopShortcuts.forEach(({ description, keys }) => {
|
|
if (!mergedShortcuts[description]) {
|
|
mergedShortcuts[description] = {};
|
|
}
|
|
mergedShortcuts[description].desktop = keys;
|
|
});
|
|
|
|
const rows = Object.entries(mergedShortcuts)
|
|
.map(([description, { web, desktop }]) => {
|
|
const webKeys = web?.map((k) => formatKey(k)).join(" / ") || "-";
|
|
const windowsLinuxKeys =
|
|
desktop?.map((k) => formatKey(k)).join(" / ") || "-";
|
|
const macKeys =
|
|
desktop
|
|
?.map(macify)
|
|
.map((k) => formatKey(k, true))
|
|
.join(" / ") || "-";
|
|
|
|
return `| ${description} | ${webKeys} | ${windowsLinuxKeys} | ${macKeys} |`;
|
|
})
|
|
.join("\n");
|
|
|
|
return `## ${category}\n\n${header}\n${rows}`;
|
|
}).join("\n\n");
|
|
}
|