Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devcontainer/test-custom-devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test",
"name": "Test postCreateCommand",
"image": "mcr.microsoft.com/devcontainers/universal:linux",

"settings": {
Expand All @@ -22,6 +22,6 @@
"forwardPorts": [5000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "echo test > aaa-TEST.txt"
"postCreateCommand": "echo Added: `date` > aaa-TEST.txt"

}
7 changes: 0 additions & 7 deletions content/get-started/using-git/about-git.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,3 @@ There are two primary ways people collaborate on {% data variables.product.produ
With a shared repository, individuals and teams are explicitly designated as contributors with read, write, or administrator access. This simple permission structure, combined with features like protected branches, helps teams progress quickly when they adopt {% data variables.product.product_name %}.

For an open source project, or for projects to which anyone can contribute, managing individual permissions can be challenging, but a fork and pull model allows anyone who can view the project to contribute. A fork is a copy of a project under a developer's personal account. Every developer has full control of their fork and is free to implement a fix or a new feature. Work completed in forks is either kept separate, or is surfaced back to the original project via a pull request. There, maintainers can review the suggested changes before they're merged. For more information, see "[AUTOTITLE](/get-started/quickstart/contributing-to-projects)."

## Further reading

The {% data variables.product.product_name %} team has created a library of educational videos and guides to help users continue to develop their skills and build better software.

- [Beginner projects to explore](https://github.com/showcases/great-for-new-contributors)
- [{% data variables.product.product_name %} video guides](https://youtube.com/githubguides)
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ We recommend testing your site locally, which allows you to see build error mess

## Viewing Jekyll build error messages in your pull request with a third-party CI service

You can configure a third-party service, such as [Travis CI](https://travis-ci.org/), to display error messages after each commit.
You can configure a third-party service, such as [Travis CI](https://travis-ci.com/), to display error messages after each commit.

1. If you haven't already, add a file called _Gemfile_ in the root of your publishing source, with the following content:
```ruby
source `https://rubygems.org`
gem `github-pages`
```

2. Configure your site's repository for the testing service of your choice. For example, to use [Travis CI](https://travis-ci.org/), add a file named _.travis.yml_ in the root of your publishing source, with the following content:
2. Configure your site's repository for the testing service of your choice. For example, to use [Travis CI](https://travis-ci.com/), add a file named _.travis.yml_ in the root of your publishing source, with the following content:
```yaml
language: ruby
rvm:
Expand Down
2 changes: 1 addition & 1 deletion content/rest/guides/building-a-ci-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ You can always rely on [GitHub integrations][integrations].
[webhook]: /webhooks/
[octokit.rb]: https://github.com/octokit/octokit.rb
[access token]: /articles/creating-an-access-token-for-command-line-use
[travis api]: https://api.travis-ci.org/docs/
[travis api]: https://api.travis-ci.com/docs/
[janky]: https://github.com/github/janky
[heaven]: https://github.com/atmos/heaven
[hubot]: https://github.com/github/hubot
Expand Down
2 changes: 1 addition & 1 deletion content/rest/guides/delivering-deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ You can always rely on [GitHub integrations][integrations].
[webhook]: /webhooks/
[octokit.rb]: https://github.com/octokit/octokit.rb
[access token]: /articles/creating-an-access-token-for-command-line-use
[travis api]: https://api.travis-ci.org/docs/
[travis api]: https://api.travis-ci.com/docs/
[janky]: https://github.com/github/janky
[heaven]: https://github.com/atmos/heaven
[hubot]: https://github.com/github/hubot
Expand Down
5 changes: 5 additions & 0 deletions contributing/content-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ For more information, see the [content model](/contributing/content-model.md#tit

## Images

We use static images including screenshots, diagrams, and graphs throughout the docs to complement textual information.

Do not use animated GIFs in the docs.

### Alt text

Every image must include alt text providing a textual equivalent of the visual information.
Expand Down Expand Up @@ -371,6 +375,7 @@ Some best practices for using links:
- Links should be meaningful and provide high value to the user’s journey—link out carefully.
- Move links that are helpful but not necessary to an article’s further reading section.
- Do not repeat the same link more than once in the same article or under the same H2 header.
- Do not include the `apiVersion` query parameter in REST links unless you need to link to a specific calendar version of the REST docs. (This should be a rare occurance.)

For accessibility and readability, avoid inline or midsentence links.
- **Use:** OAuth2 tokens can be acquired programmatically for applications that are not websites. For more information, see "[Setting up and registering OAuth Apps](https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/)" and "[Create a new authorization](https://docs.github.com/en/enterprise-server@2.22/rest/reference/oauth-authorizations/#create-a-new-authorization)."
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/content/get-started/images/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ versions:
children:
- /single-image
- /images-in-lists
- /link-to-image
---
14 changes: 14 additions & 0 deletions tests/fixtures/content/get-started/images/link-to-image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Link to image
intro: You can link directly to an asset
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
type: how_to
---

## Expand your mind

[View image](/assets/images/_fixtures/screenshot.png)
13 changes: 12 additions & 1 deletion tests/rendering-fixtures/images.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sharp from 'sharp'

import { get, getDOM } from '../helpers/e2etest.js'
import { get, head, getDOM } from '../helpers/e2etest.js'

describe('render Markdown image tags', () => {
test('page with a single image', async () => {
Expand Down Expand Up @@ -46,4 +46,15 @@ describe('render Markdown image tags', () => {
const imageSpan = $('#article-contents > div > ol > li > span.procedural-image-wrapper')
expect(imageSpan.length).toBe(1)
})

test("links directly to images aren't rewritten", async () => {
const $ = await getDOM('/get-started/images/link-to-image')
// There is only 1 link inside that page
const links = $('#article-contents a[href^="/"]') // exclude header link
expect(links.length).toBe(1)
// This proves that the link didn't get rewritten to `/en/...`
expect(links.attr('href'), '/assets/images/_fixtures/screenshot.png')
const res = await head(links.attr('href'))
expect(res.statusCode).toBe(200)
})
})
101 changes: 0 additions & 101 deletions tests/rendering/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,107 +284,6 @@ describe('server', () => {
expect($('a[href="/en/authentication/keeping-your-account-and-data-secure"]')).toHaveLength(1)
})

describe('image asset paths', () => {
const localImageCacheBustBasePathRegex = /^\/assets\/cb-\d+\/images\//
const localImageBasePath = '/assets/images'
const legacyImageBasePath = '/assets/enterprise'
const latestEnterprisePath = `/en/enterprise/${enterpriseServerReleases.latest}`
const oldestEnterprisePath = `/en/enterprise/${enterpriseServerReleases.oldestSupported}`

test('github articles on dotcom have images that point to local assets dir', async () => {
const $ = await getDOM(
'/en/github/authenticating-to-github/configuring-two-factor-authentication'
)
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) || imageSrc.startsWith(localImageBasePath)
).toBe(true)
})

test('github articles on GHE have images that point to local assets dir', async () => {
const $ = await getDOM(
`${latestEnterprisePath}/user/github/authenticating-to-github/configuring-two-factor-authentication`
)
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) ||
imageSrc.startsWith(localImageBasePath) ||
imageSrc.startsWith(legacyImageBasePath)
).toBe(true)
})

test('admin articles on latest version of GHE have images that point to local assets dir', async () => {
const $ = await getDOM(
`${latestEnterprisePath}/admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise`
)
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) ||
imageSrc.startsWith(localImageBasePath) ||
imageSrc.startsWith(legacyImageBasePath)
).toBe(true)
})

test('admin articles on older GHE versions have images that point to local assets dir', async () => {
const $ = await getDOM(
`${oldestEnterprisePath}/admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise`
)
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) ||
imageSrc.startsWith(localImageBasePath) ||
imageSrc.startsWith(legacyImageBasePath)
).toBe(true)
})

test('links that point to /assets are not rewritten with a language code', async () => {
const $ = await getDOM('/en/site-policy/privacy-policies/github-privacy-statement')
expect($('#french').next().children('a').attr('href').startsWith(localImageBasePath)).toBe(
true
)
})

test('github articles on GHEC have images that point to local assets dir', async () => {
const $ = await getDOM(
'/en/enterprise-cloud@latest/billing/managing-billing-for-your-github-account/viewing-the-subscription-and-usage-for-your-enterprise-account'
)
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) || imageSrc.startsWith(localImageBasePath)
).toBe(true)
})

test('admin articles on GHEC have images that point to local assets dir', async () => {
const $ = await getDOM(
'/en/enterprise-cloud@latest/admin/configuration/configuring-your-enterprise/verifying-or-approving-a-domain-for-your-enterprise'
)
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) || imageSrc.startsWith(localImageBasePath)
).toBe(true)
})

test('github articles on GHAE have images that point to local assets dir', async () => {
const $ = await getDOM(
'/en/github-ae@latest/github/administering-a-repository/changing-the-default-branch'
)
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) ||
imageSrc.startsWith(localImageBasePath) ||
imageSrc.startsWith(legacyImageBasePath)
).toBe(true)
})

test('admin articles on GHAE have images that point to local assets dir', async () => {
const $ = await getDOM('/en/github-ae@latest/admin/user-management/managing-dormant-users')
const imageSrc = $('img').first().attr('src')
expect(
localImageCacheBustBasePathRegex.test(imageSrc) || imageSrc.startsWith(localImageBasePath)
).toBe(true)
})
})

describe('English local links', () => {
const latestEnterprisePath = `/en/enterprise-server@${enterpriseServerReleases.latest}`

Expand Down