Skip to content

Commit 6c2b301

Browse files
authored
Merge pull request github#18655 from github/repo-sync
repo sync
2 parents 6b97059 + e11f902 commit 6c2b301

File tree

13 files changed

+367
-2082
lines changed

13 files changed

+367
-2082
lines changed

.github/workflows/pa11y.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.pa11yci

Lines changed: 0 additions & 102 deletions
This file was deleted.

components/context/ArticleContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type LearningTrack = {
88
}
99

1010
export type MiniTocItem = {
11-
platform: string
11+
platform?: string
1212
contents: {
1313
href: string
1414
title: string

content/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Because user-level permissions are granted on an individual user basis, you can
158158

159159
## User-to-server requests
160160

161-
While most of your API interaction should occur using your server-to-server installation access tokens, certain endpoints allow you to perform actions via the API using a user access token. Your app can make the following requests using [GraphQL v4]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql) or [REST v3](/rest) endpoints.
161+
While most of your API interaction should occur using your server-to-server installation access tokens, certain endpoints allow you to perform actions via the API using a user access token. Your app can make the following requests using [GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql) or [REST](/rest) endpoints.
162162

163163
### Supported endpoints
164164

content/developers/apps/getting-started-with-apps/migrating-oauth-apps-to-github-apps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ We recommend reviewing the list of API endpoints you need as early as possible.
5252

5353
### Design to stay within API rate limits
5454

55-
GitHub Apps use [sliding rules for rate limits](/apps/building-github-apps/understanding-rate-limits-for-github-apps/), which can increase based on the number of repositories and users in the organization. A GitHub App can also make use of [conditional requests](/rest/overview/resources-in-the-rest-api#conditional-requests) or consolidate requests by using the [GraphQL API V4]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql).
55+
GitHub Apps use [sliding rules for rate limits](/apps/building-github-apps/understanding-rate-limits-for-github-apps/), which can increase based on the number of repositories and users in the organization. A GitHub App can also make use of [conditional requests](/rest/overview/resources-in-the-rest-api#conditional-requests) or consolidate requests by using the [GraphQL API]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql).
5656

5757
### Register a new GitHub App
5858

content/developers/overview/about-githubs-apis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ topics:
1414
- API
1515
---
1616

17-
There are two stable versions of the GitHub API: the [REST API](/rest) and the [GraphQL API]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql). When using the REST API, we encourage you to [request v3 via the `Accept` header](/v3/media/#request-specific-version). For information on using the GraphQL API, see the [v4 docs]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql).
17+
There are two stable versions of the GitHub API: the [REST API](/rest) and the [GraphQL API]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql).
1818

1919
## Deprecated versions
2020

content/graphql/guides/using-global-node-ids.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ topics:
1212
- API
1313
---
1414

15-
You can access most objects in GitHub (users, issues, pull requests, etc.) using either the REST API or the GraphQL API. You can find the **global node ID** of many objects from within the REST API and use these IDs in your GraphQL operations. For more information, see "[Preview GraphQL API v4 Node IDs in REST API v3 resources](https://developer.github.com/changes/2017-12-19-graphql-node-id/)."
15+
You can access most objects in GitHub (users, issues, pull requests, etc.) using either the REST API or the GraphQL API. You can find the **global node ID** of many objects from within the REST API and use these IDs in your GraphQL operations. For more information, see "[Preview GraphQL API Node IDs in REST API resources](https://developer.github.com/changes/2017-12-19-graphql-node-id/)."
1616

1717
{% note %}
1818

content/graphql/overview/resource-limitations.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ topics:
1414

1515
## Node limit
1616

17-
To pass [schema](/graphql/guides/introduction-to-graphql#schema) validation, all GraphQL API v4 [calls](/graphql/guides/forming-calls-with-graphql) must meet these standards:
17+
To pass [schema](/graphql/guides/introduction-to-graphql#schema) validation, all GraphQL API [calls](/graphql/guides/forming-calls-with-graphql) must meet these standards:
1818

1919
* Clients must supply a `first` or `last` argument on any [connection](/graphql/guides/introduction-to-graphql#connection).
2020
* Values of `first` and `last` must be within 1-100.
@@ -130,30 +130,30 @@ These two examples show how to calculate the total nodes in a call.
130130

131131
## Rate limit
132132

133-
The GraphQL API v4 limit is different from the REST API v3's [rate limits](/rest/overview/resources-in-the-rest-api#rate-limiting).
133+
The GraphQL API limit is different from the REST API's [rate limits](/rest/overview/resources-in-the-rest-api#rate-limiting).
134134

135135
Why are the API rate limits different? With [GraphQL](/graphql), one GraphQL call can replace [multiple REST calls](/graphql/guides/migrating-from-rest-to-graphql). A single complex GraphQL call could be the equivalent of thousands of REST requests. While a single GraphQL call would fall well below the REST API rate limit, the query might be just as expensive for GitHub's servers to compute.
136136

137-
To accurately represent the server cost of a query, the GraphQL API v4 calculates a call's **rate limit score** based on a normalized scale of points. A query's score factors in first and last arguments on a parent connection and its children.
137+
To accurately represent the server cost of a query, the GraphQL API calculates a call's **rate limit score** based on a normalized scale of points. A query's score factors in first and last arguments on a parent connection and its children.
138138

139139
* The formula uses the `first` and `last` arguments on a parent connection and its children to pre-calculate the potential load on GitHub's systems, such as MySQL, ElasticSearch, and Git.
140140
* Each new connection has its own point value. Points are combined with other points from the call into an overall rate limit score.
141141

142-
The GraphQL API v4 rate limit is **5,000 points per hour**.
142+
The GraphQL API rate limit is **5,000 points per hour**.
143143

144-
Note that 5,000 points per hour is not the same as 5,000 calls per hour: the GraphQL API v4 and REST API v3 use different rate limits.
144+
Note that 5,000 points per hour is not the same as 5,000 calls per hour: the GraphQL API and REST API use different rate limits.
145145

146146
{% note %}
147147

148-
**Note**: The current formula and rate limit are subject to change as we observe how developers use the GraphQL API v4.
148+
**Note**: The current formula and rate limit are subject to change as we observe how developers use the GraphQL API.
149149

150150
{% endnote %}
151151

152152
### Returning a call's rate limit status
153153

154-
With the REST API v3, you can check the rate limit status by [inspecting](/rest/overview/resources-in-the-rest-api#rate-limiting) the returned HTTP headers.
154+
With the REST API, you can check the rate limit status by [inspecting](/rest/overview/resources-in-the-rest-api#rate-limiting) the returned HTTP headers.
155155

156-
With the GraphQL API v4, you can check the rate limit status by querying fields on the `rateLimit` object:
156+
With the GraphQL API, you can check the rate limit status by querying fields on the `rateLimit` object:
157157

158158
```graphql
159159
query {
@@ -186,7 +186,7 @@ Querying the `rateLimit` object returns a call's score, but running the call cou
186186

187187
{% note %}
188188

189-
**Note**: The minimum cost of a call to the GraphQL API v4 is **1**, representing a single request.
189+
**Note**: The minimum cost of a call to the GraphQL API is **1**, representing a single request.
190190

191191
{% endnote %}
192192

content/rest/overview/resources-in-the-rest-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ We encourage you to [explicitly request this version via the `Accept` header](/r
2525

2626
{% ifversion fpt or ghec %}
2727

28-
For information about GitHub's GraphQL API, see the [v4 documentation]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql). For information about migrating to GraphQL, see "[Migrating from REST]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/guides/migrating-from-rest-to-graphql)."
28+
For information about GitHub's GraphQL API, see the [documentation]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql). For information about migrating to GraphQL, see "[Migrating from REST]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/guides/migrating-from-rest-to-graphql)."
2929

3030
{% endif %}
3131

lib/get-mini-toc-items.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import cheerio from 'cheerio'
22
import { range } from 'lodash-es'
33

4-
export default function getMiniTocItems(
5-
html,
6-
maxHeadingLevel = 2,
7-
headingScope = '',
8-
isRestPage = false
9-
) {
4+
export default function getMiniTocItems(html, maxHeadingLevel = 2, headingScope = '') {
105
const $ = cheerio.load(html, { xmlMode: true })
116

127
// eg `h2, h3` or `h2, h3, h4` depending on maxHeadingLevel
@@ -67,7 +62,7 @@ export default function getMiniTocItems(
6762
// convert the flatToc to a nested structure to simplify semantic rendering on the client
6863
const nestedToc = buildNestedToc(flatToc)
6964

70-
return nestedToc
65+
return minimalMiniToc(nestedToc)
7166
}
7267

7368
// Recursively build a tree from the list of allItems
@@ -116,3 +111,15 @@ function buildNestedToc(allItems, startIndex = 0) {
116111

117112
return currentLevel
118113
}
114+
115+
// Strip the bits and pieces from each object in the array that are
116+
// not needed in the React component rendering.
117+
function minimalMiniToc(toc) {
118+
return toc.map(({ platform, contents, items }) => {
119+
const minimal = { contents }
120+
const subItems = minimalMiniToc(items)
121+
if (subItems.length) minimal.items = subItems
122+
if (platform) minimal.platform = platform
123+
return minimal
124+
})
125+
}

0 commit comments

Comments
 (0)