Skip to content

Commit

Permalink
Add vscode as an option for the application selector (github#21798)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
timeyoutakeit and hubwriter committed Oct 7, 2021
1 parent 3938d02 commit e82f64f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/lib/display-tool-specific-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { preserveAnchorNodePosition } from 'scroll-anchoring'

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

const supportedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces']
const supportedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces', 'vscode']

export default function displayToolSpecificContent() {
const toolElements = Array.from(document.querySelectorAll('.extended-markdown')).filter((el) =>
Expand Down
2 changes: 1 addition & 1 deletion content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ defaultPlatform: linux
### `defaultTool`

- 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.
- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`.
- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`.
- Optional.

```yaml
Expand Down
20 changes: 19 additions & 1 deletion contributing/content-markup-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- [Usage](#usage-2)
- [Operating system tags](#operating-system-tags)
- [Usage](#usage-3)
- [Tool tags](#tool-tags)
- [Usage](#usage-4)
- [Reusable and variable strings of text](#reusable-and-variable-strings-of-text)

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

## Tool tags

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.
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.

### Usage

Expand Down Expand Up @@ -138,6 +140,22 @@ These instructions are pertinent to cURL users.
{% endcurl %}
```

```
{% codespaces %}
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.
{% endcodespaces %}
```

```
{% vscode %}
These instructions are pertinent to VS Code users.
{% endvscode %}
```

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.

You can define a default tool in the frontmatter. For more information, see the [content README](../content/README.md#defaulttool).
Expand Down
1 change: 1 addition & 0 deletions includes/tool-switcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="curl">cURL</a>
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="desktop">Desktop</a>
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="codespaces">Codespaces</a>
<a href="#" class="UnderlineNav-item tool-switcher" data-tool="vscode">Visual Studio Code</a>
</div>
</nav>
2 changes: 1 addition & 1 deletion lib/frontmatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const schema = {
// Tool-specific content preference
defaultTool: {
type: 'string',
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces'],
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'],
},
// Documentation contributed by a third party, such as a GitHub Partner
contributor: {
Expand Down
1 change: 1 addition & 0 deletions lib/liquid-tags/extended-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const tags = {
webui: '',
curl: '',
codespaces: '',
vscode: '',
all: '',
tip: 'border rounded-1 mb-4 p-3 color-border-info color-bg-info f5',
note: 'border rounded-1 mb-4 p-3 color-border-info color-bg-info f5',
Expand Down
3 changes: 2 additions & 1 deletion lib/schema-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const context = {
},
application_preference: {
type: 'string',
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces'],
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'],
description: 'The application selected by the user.',
},
color_mode_preference: {
Expand Down Expand Up @@ -404,6 +404,7 @@ const preferenceSchema = {
'desktop',
'curl',
'codespaces',
'vscode',
'dark',
'light',
'auto',
Expand Down

0 comments on commit e82f64f

Please sign in to comment.