From fc1ff198f7b9c7dc2b3e08848524ab1abdb89e2b Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Thu, 16 Oct 2025 13:28:23 -0700 Subject: [PATCH] Move src/bookmarklets to docs-team (#58026) --- .prettierignore | 1 - .../creating-a-local-environment.md | 4 -- contributing/development.md | 2 - eslint.config.js | 1 - src/bookmarklets/README.md | 41 ------------------- src/bookmarklets/open-in-vscode.js | 8 ---- src/bookmarklets/view-in-development.js | 1 - src/bookmarklets/view-in-production.js | 1 - 8 files changed, 59 deletions(-) delete mode 100644 src/bookmarklets/README.md delete mode 100644 src/bookmarklets/open-in-vscode.js delete mode 100644 src/bookmarklets/view-in-development.js delete mode 100644 src/bookmarklets/view-in-production.js diff --git a/.prettierignore b/.prettierignore index 5c6d47147f..86cc8b982b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1 @@ data/release-notes/ -src/bookmarklets/ diff --git a/content/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment.md b/content/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment.md index 178824fd2b..5fa3d6cd93 100644 --- a/content/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment.md +++ b/content/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment.md @@ -61,10 +61,6 @@ When you're ready to stop your local server, type Ctrl+C i If you would like to read more about debugging and troubleshooting the {% data variables.product.prodname_docs %} application, see [AUTOTITLE](/contributing/setting-up-your-environment-to-work-on-github-docs/troubleshooting-your-environment) in the github/docs repository. -### Using browser shortcuts - -The [`src/bookmarklets`](https://github.com/github/docs/tree/main/src/bookmarklets) directory in the {% data variables.product.prodname_docs %} repository contains browser shortcuts that can help with reviewing {% data variables.product.company_short %} documentation. For more information, see the directory's [`README`](https://github.com/github/docs/tree/main/src/bookmarklets/README.md). - ### Enabling different languages By default, the local server does not run with all supported languages enabled. If you need to run a local server with a particular language, you can temporarily edit the `start` script in `package.json` and update the `ENABLED_LANGUAGES` variable. diff --git a/contributing/development.md b/contributing/development.md index f1f3aa52d2..86a51865de 100644 --- a/contributing/development.md +++ b/contributing/development.md @@ -36,9 +36,7 @@ As an alternative, you can simply use [GitHub Codespaces](https://docs.github.co In a matter of minutes, you will be ready to edit, review and test your changes directly from the comfort of your browser. -### Using browser shortcuts -The [`src/bookmarklets`](../src/bookmarklets) directory contains some browser shortcuts that can help with reviewing GitHub documentation. See [`src/bookmarklets/README.md`](../src/bookmarklets/README.md) for details. ### Enabling different languages diff --git a/eslint.config.js b/eslint.config.js index 233e34d4d2..8fa152a4b4 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -215,7 +215,6 @@ export default [ ignores: [ 'tmp/*', '.next/', - 'src/bookmarklets/*', 'rest-api-description/', 'docs-internal-data/', 'src/code-scanning/scripts/generate-code-scanning-query-list.ts', diff --git a/src/bookmarklets/README.md b/src/bookmarklets/README.md deleted file mode 100644 index 41823b7c9b..0000000000 --- a/src/bookmarklets/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Bookmarklets - -The [bookmarklets](https://en.wikipedia.org/wiki/Bookmarklet) in this directory are browser shortcuts that may help with reviewing GitHub documentation. We may eventually build the functionality they provide into Docs review environments, but these are handy hacks for now. - -## Installing bookmarklets - -For each bookmarklet described below, create a new bookmark in your browser with a descriptive name, open the JavaScript file and copy its contents, and paste the JavaScript _as the bookmark's URL_. - -Clicking the bookmark will then execute the JavaScript. - -⚠️ For Safari, you'll need to do the following: - -1. Go to **Safari** > **Preferences** > **Advanced** and enable **Show Develop menu in menu bar**. -2. Go to **Develop** and enable **Allow JavaScript from Smart Search field**. - -## "View in development" toggle - -[`src/bookmarklets/view-in-development.js`](./view-in-development.js) - -When you're looking at a page on docs.github.com, clicking this bookmarklet will load the same path you're viewing but on your local server running at localhost:4000. - -## "View in production" toggle - -[`src/bookmarklets/view-in-production.js`](./view-in-production.js) - -When you're looking at a page on your local server running at localhost:4000, clicking this bookmarklet will load the same path you're viewing but on the live documentation site at docs.github.com. - -## Open a docs article in VS Code - -[`src/bookmarklets/open-in-vscode.js`](./open-in-vscode.js) - -When you're looking at a page on either docs.github.com, review, or localhost:4000, clicking this bookmarklet will open the source Markdown file from your local checkout in VS Code. - -The installation requires a few steps: - -1. Copy the contents of [`src/bookmarklets/open-in-vscode.js`](./open-in-vscode.js). -1. Browse to https://chriszarate.github.io/bookmarkleter/ and paste the code into the box. -1. Find the path of **your local checkout** of the docs repo you want to open files from (for example, `/Users//repos/docs`). -1. Paste the path in place of where it says `REPLACE_ME` in line 1 (make sure to leave the single quotes around it). -1. Change the title to something like `Open in VSC`. -1. Drag the generated link onto your bookmarks bar. diff --git a/src/bookmarklets/open-in-vscode.js b/src/bookmarklets/open-in-vscode.js deleted file mode 100644 index f49fca3df8..0000000000 --- a/src/bookmarklets/open-in-vscode.js +++ /dev/null @@ -1,8 +0,0 @@ -/* The path to your local copy of repo */ -const checkoutPath = 'REPLACE_ME' - -const filepath = window.location.pathname.replace(/\/en\/([^@]+?@[^@]+?\/)?/, '/content/') -const isIndexFile = filepath.split('/').length < 5 -const filename = isIndexFile ? '/index.md' : '.md' -const fullpath = 'vscode://file' + checkoutPath + filepath + filename -window.open(fullpath, '_blank') diff --git a/src/bookmarklets/view-in-development.js b/src/bookmarklets/view-in-development.js deleted file mode 100644 index 025d74eb04..0000000000 --- a/src/bookmarklets/view-in-development.js +++ /dev/null @@ -1 +0,0 @@ -javascript:(()=>{window.location.href=window.location.href.replace(/https:\/\/docs\.github\.com/,'http://localhost:4000').replace(/https:\/\/.*\..*\.(com|net|dev|io|org|ms)/,'http://localhost:4000')})() diff --git a/src/bookmarklets/view-in-production.js b/src/bookmarklets/view-in-production.js deleted file mode 100644 index a22e139b48..0000000000 --- a/src/bookmarklets/view-in-production.js +++ /dev/null @@ -1 +0,0 @@ -javascript:(()=>{window.location.href=window.location.href.replace(/http:\/\/localhost:4000/,'https://docs.github.com').replace(/https:\/\/.*\..*\.(com|net|dev|io|org|ms)/,'https://docs.github.com')})()