Skip to content

Commit e82f64f

Browse files
Add vscode as an option for the application selector (#21798)
* adding switcher to creating a codespace guide * adding additional switcher for vscode and updating codespaces name * using webui in codespaces coontext * updating internal documentation * remove default tool Co-authored-by: hubwriter <hubwriter@github.com>
1 parent 3938d02 commit e82f64f

File tree

7 files changed

+26
-5
lines changed

7 files changed

+26
-5
lines changed

components/lib/display-tool-specific-content.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { preserveAnchorNodePosition } from 'scroll-anchoring'
33

44
import { sendEvent, EventType } from './events'
55

6-
const supportedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces']
6+
const supportedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces', 'vscode']
77

88
export default function displayToolSpecificContent() {
99
const toolElements = Array.from(document.querySelectorAll('.extended-markdown')).filter((el) =>

content/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ defaultPlatform: linux
220220
### `defaultTool`
221221

222222
- Purpose: Override the initial tool selection for a page, where tool refers to the application the reader is using to work with GitHub (such as GitHub.com's web UI, the GitHub CLI, or GitHub Desktop) or the GitHub APIs (such as cURL or the GitHub CLI). If this frontmatter is omitted, then the tool-specific content matching the GitHub web UI is shown by default. This behavior can be changed for individual pages, for which a manual selection is more reasonable.
223-
- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`.
223+
- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`.
224224
- Optional.
225225

226226
```yaml

contributing/content-markup-reference.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
- [Usage](#usage-2)
1111
- [Operating system tags](#operating-system-tags)
1212
- [Usage](#usage-3)
13+
- [Tool tags](#tool-tags)
14+
- [Usage](#usage-4)
1315
- [Reusable and variable strings of text](#reusable-and-variable-strings-of-text)
1416

1517
## Writing in Markdown
@@ -102,7 +104,7 @@ You can define a default platform in the frontmatter. For more information, see
102104

103105
## Tool tags
104106

105-
We occasionally need to write documentation for different tools (GitHub UI, GitHub CLI, GitHub Desktop, cURL). Each tool may require a different set of instructions. We use tool tags to demarcate information for each tool.
107+
We occasionally need to write documentation for different tools (GitHub UI, GitHub CLI, GitHub Desktop, cURL, Codespaces, VS Code). Each tool may require a different set of instructions. We use tool tags to demarcate information for each tool.
106108

107109
### Usage
108110

@@ -138,6 +140,22 @@ These instructions are pertinent to cURL users.
138140
{% endcurl %}
139141
```
140142

143+
```
144+
{% codespaces %}
145+
146+
These instructions are pertinent to Codespaces users. They are mostly used outside the Codespaces docset, when we want to refer to how to do something inside Codespaces. Otherwise `webui` or `vscode` may be used.
147+
148+
{% endcodespaces %}
149+
```
150+
151+
```
152+
{% vscode %}
153+
154+
These instructions are pertinent to VS Code users.
155+
156+
{% endvscode %}
157+
```
158+
141159
Unlike [operating system tags](#operating-system-tags), which will automatically add tabs to select the operating system at the top of the article, you must add `{% include tool-switcher %}` wherever you want to display tabs to select the tool. This allows you to display the tabs at the top of the article or immediately before a relevant section.
142160

143161
You can define a default tool in the frontmatter. For more information, see the [content README](../content/README.md#defaulttool).

includes/tool-switcher.html

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="curl">cURL</a>
77
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="desktop">Desktop</a>
88
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="codespaces">Codespaces</a>
9+
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="vscode">Visual Studio Code</a>
910
</div>
1011
</nav>

lib/frontmatter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const schema = {
157157
// Tool-specific content preference
158158
defaultTool: {
159159
type: 'string',
160-
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces'],
160+
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'],
161161
},
162162
// Documentation contributed by a third party, such as a GitHub Partner
163163
contributor: {

lib/liquid-tags/extended-markdown.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const tags = {
77
webui: '',
88
curl: '',
99
codespaces: '',
10+
vscode: '',
1011
all: '',
1112
tip: 'border rounded-1 mb-4 p-3 color-border-info color-bg-info f5',
1213
note: 'border rounded-1 mb-4 p-3 color-border-info color-bg-info f5',

lib/schema-event.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const context = {
146146
},
147147
application_preference: {
148148
type: 'string',
149-
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces'],
149+
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'],
150150
description: 'The application selected by the user.',
151151
},
152152
color_mode_preference: {
@@ -404,6 +404,7 @@ const preferenceSchema = {
404404
'desktop',
405405
'curl',
406406
'codespaces',
407+
'vscode',
407408
'dark',
408409
'light',
409410
'auto',

0 commit comments

Comments
 (0)