Skip to content

Commit 3a48c07

Browse files
petebacondarwinalxhub
authored andcommitted
build(docs-infra): ensure that terminal code snippets render correctly (angular#41986)
After the changes to the `lang-none` styling in angular#41335, code snippets marked with ``` language="none" class="code-shell" ``` were being styled with the same foreground and background colours. It turns out that most of these ought to be marked `language="sh"` in which case the `code-shell` style became redundant and has been removed. Fixes angular#41984 PR Close angular#41986
1 parent 4bc3cf2 commit 3a48c07

30 files changed

+104
-109
lines changed

aio/content/cli/usage-analytics-gathering.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,27 @@ This ID is a string that looks like `UA-123456-12`.
2020
You can choose to use a descriptive string as the key value, or be assigned a random key when you run the CLI command.
2121
For example, the following command adds a configuration key named "tracking".
2222

23-
<code-example language="sh" class="code-shell">
23+
<code-example language="sh">
2424
ng config --global cli.analyticsSharing.tracking UA-123456-12
2525
</code-example>
2626

2727
To turn off this feature, run the following command:
2828

29-
<code-example language="sh" class="code-shell">
29+
<code-example language="sh">
3030
ng config --global --remove cli.analyticsSharing
3131
</code-example>
3232

33-
3433
## Per user tracking
3534

3635
You can add a custom user ID to the global configuration, in order to identify unique usage of commands and flags.
3736
If that user enables CLI analytics for their own project, your analytics display tracks and labels their individual usage.
3837

39-
40-
<code-example language="sh" class="code-shell">
38+
<code-example language="sh">
4139
ng config --global cli.analyticsSharing.user SOME_USER_NAME
4240
</code-example>
4341

4442
To generate a new random user ID, run the following command:
4543

46-
<code-example language="sh" class="code-shell">
44+
<code-example language="sh">
4745
ng config --global cli.analyticsSharing.user ""
4846
</code-example>

aio/content/guide/attribute-directives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This section walks you through creating a highlight directive that sets the back
1414

1515
1. To create a directive, use the CLI command [`ng generate directive`](cli/generate).
1616

17-
<code-example language="sh" class="code-shell">
17+
<code-example language="sh">
1818
ng generate directive highlight
1919
</code-example>
2020

aio/content/guide/browser-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ This file incorporates the mandatory and many of the optional polyfills as JavaS
8787

8888
For example, if you need the optional [web animations polyfill](https://caniuse.com/web-animation), you could install it with `npm`, using the following command (or the `yarn` equivalent):
8989

90-
<code-example language="sh" class="code-shell">
90+
<code-example language="sh">
9191
# install the optional web animations polyfill
9292
npm install --save web-animations-js
9393
</code-example>

aio/content/guide/build.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export class AppComponent {
9494
title = 'app works!';
9595
}
9696
```
97+
9798
{@a file-replacement}
9899

99100
## Configure target-specific file replacements
@@ -140,7 +141,7 @@ Any option that your build supports can be overridden in a build target configur
140141

141142
To build using the staging configuration, run the following command:
142143

143-
<code-example language="sh" class="code-shell">
144+
<code-example language="sh">
144145
ng build --configuration=staging
145146
</code-example>
146147

@@ -503,7 +504,7 @@ module.exports = PROXY_CONFIG;
503504
If you work behind a corporate proxy, the backend cannot directly proxy calls to any URL outside your local network.
504505
In this case, you can configure the backend proxy to redirect calls through your corporate proxy using an agent:
505506
506-
<code-example language="none" class="code-shell">
507+
<code-example language="sh">
507508
npm install --save-dev https-proxy-agent
508509
</code-example>
509510

aio/content/guide/component-styles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ They are _not inherited_ by any components nested within the template nor by any
170170

171171
The Angular CLI command [`ng generate component`](cli/generate) defines an empty `styles` array when you create the component with the `--inline-style` flag.
172172

173-
<code-example language="sh" class="code-shell">
173+
<code-example language="sh">
174174
ng generate component hero-app --inline-style
175175
</code-example>
176176

@@ -199,7 +199,7 @@ They are _not inherited_ by any components nested within the template nor by any
199199

200200
When you use the Angular CLI command [`ng generate component`](cli/generate) without the `--inline-style` flag, it creates an empty styles file for you and references that file in the component's generated `styleUrls`.
201201

202-
<code-example language="sh" class="code-shell">
202+
<code-example language="sh">
203203
ng generate component hero-app
204204
</code-example>
205205

aio/content/guide/dependency-injection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ See the <live-example></live-example> for a working example containing the code
1616

1717
To generate a new `HeroService` class in the `src/app/heroes` folder use the following [Angular CLI](cli) command.
1818

19-
<code-example language="sh" class="code-shell">
19+
<code-example language="sh">
2020
ng generate service heroes/hero
2121
</code-example>
2222

aio/content/guide/deployment.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ You will need two terminals to get the live-reload experience.
2929

3030
* On the first terminal, run the [`ng build` command](cli/build) in *watch* mode to compile the application to the `dist` folder.
3131

32-
<code-example language="none" class="code-shell">
32+
<code-example language="sh">
3333

3434
ng build --watch
3535

@@ -39,7 +39,7 @@ You will need two terminals to get the live-reload experience.
3939

4040
* On the second terminal, install a web server (such as [lite-server](https://github.com/johnpapa/lite-server)), and run it against the output folder. For example:
4141

42-
<code-example language="none" class="code-shell">
42+
<code-example language="sh">
4343

4444
lite-server --baseDir="dist/project-name"
4545

@@ -61,7 +61,7 @@ When you add a package with deployment capability, it'll automatically update yo
6161

6262
For example, the following command automatically deploys a project to Firebase.
6363

64-
<code-example language="none" class="code-shell">
64+
<code-example language="sh">
6565
ng add @angular/fire
6666
ng deploy
6767
</code-example>
@@ -90,13 +90,12 @@ For the simplest deployment, create a production build and copy the output direc
9090

9191
1. Start with the production build:
9292

93-
<code-example language="none" class="code-shell">
93+
<code-example language="sh">
9494

9595
ng build
9696

9797
</code-example>
9898

99-
10099
2. Copy _everything_ within the output folder (`dist/project-name/` by default) to a folder on the server.
101100

102101
3. Configure the server to redirect requests for missing files to `index.html`.
@@ -121,6 +120,7 @@ To deploy your Angular application to [GitHub Pages](https://help.github.com/art
121120
git branch -M main
122121
git push -u origin main
123122
```
123+
124124
When you paste these commands from GitHub, they run automatically.
125125

126126
1. Create and check out a `git` branch named `gh-pages`.
@@ -133,7 +133,7 @@ To deploy your Angular application to [GitHub Pages](https://help.github.com/art
133133

134134
Be sure to include the slashes on either side of your project name as in `/your_project_name/`.
135135

136-
<code-example language="none" class="code-shell">
136+
<code-example language="sh">
137137

138138
ng build --output-path docs --base-href /your_project_name/
139139

@@ -222,7 +222,7 @@ modified to serve `index.html`:
222222

223223
* [Ruby](https://www.ruby-lang.org/): create a Ruby server using ([sinatra](http://sinatrarb.com/)) with a basic Ruby file that configures the server `server.rb`:
224224

225-
``` ruby
225+
```ruby
226226
require 'sinatra'
227227

228228
# Folder structure
@@ -385,23 +385,23 @@ tool is a great way to inspect the generated JavaScript bundles after a producti
385385

386386
Install `source-map-explorer`:
387387

388-
<code-example language="none" class="code-shell">
388+
<code-example language="sh">
389389

390390
npm install source-map-explorer --save-dev
391391

392392
</code-example>
393393

394394
Build your application for production _including the source maps_
395395

396-
<code-example language="none" class="code-shell">
396+
<code-example language="sh">
397397

398398
ng build --source-map
399399

400400
</code-example>
401401

402402
List the generated bundles in the `dist/project-name/` folder.
403403

404-
<code-example language="none" class="code-shell">
404+
<code-example language="sh">
405405

406406
ls dist/project-name/*.js
407407

@@ -410,7 +410,7 @@ List the generated bundles in the `dist/project-name/` folder.
410410
Run the explorer to generate a graphical representation of one of the bundles.
411411
The following example displays the graph for the _main_ bundle.
412412

413-
<code-example language="none" class="code-shell">
413+
<code-example language="sh">
414414

415415
node_modules/.bin/source-map-explorer dist/project-name/main*
416416

@@ -657,7 +657,7 @@ In `angular.json` add two new configuration sections under the `build` and `serv
657657

658658
You can then run the `ng serve` command with this configuration. Make sure to replace `<app-name>` (in `"<app-name>:build:es5"`) with the actual name of the app, as it appears under `projects` in `angular.json`. For example, if your application name is `myAngularApp` the configuration will become `"browserTarget": "myAngularApp:build:es5"`.
659659

660-
<code-example language="none" class="code-shell">
660+
<code-example language="sh">
661661

662662
ng serve --configuration es5
663663

@@ -698,7 +698,7 @@ Create a new file, `tsconfig-es5.spec.json` next to `tsconfig.spec.json` with th
698698

699699
You can then run the tests with this configuration
700700

701-
<code-example language="none" class="code-shell">
701+
<code-example language="sh">
702702

703703
ng test --configuration es5
704704

aio/content/guide/docs-style-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ The <code class="no-auto-link">item</code> property is `true`.
249249

250250
Ideally, you should source code snippets [from working sample code](#from-code-samples), though there are times when an inline snippet is necessary.
251251

252-
For terminal input and output, place the content between `<code-example>` tags, set the CSS class to `code-shell`, and set the language attribute to `sh` as in this example:
252+
For terminal input and output, place the content between `<code-example>` tags and set the language attribute to `sh` as in this example:
253253

254-
<code-example language="sh" class="code-shell">
254+
<code-example language="sh">
255255

256256
npm start
257257

258258
</code-example>
259259

260260
```html
261-
<code-example language="sh" class="code-shell">
261+
<code-example language="sh">
262262

263263
npm start
264264

@@ -405,7 +405,7 @@ Specify the `<code-example>` output with the following attributes:
405405
The `number` option starts line numbering at the given value.
406406
For example, `linenums=4` sets the starting line number to 4.
407407

408-
* `class`: code snippets can be styled with the CSS classes `no-box`, `code-shell`, and `avoid`.
408+
* `class`: code snippets can be styled with the CSS classes `no-box` and `avoid`.
409409

410410
* `hideCopy`: hides the copy button.
411411

aio/content/guide/i18n.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The following are optional practices that may be required in special cases:
6969

7070
To take advantage of Angular's localization features, use the Angular CLI to add the `@angular/localize` package to your project:
7171

72-
<code-example language="sh" class="code-shell">
72+
<code-example language="sh">
7373
ng add @angular/localize
7474
</code-example>
7575

@@ -343,7 +343,7 @@ You can optionally change the location, format, and name.
343343

344344
To extract the source language file, open a terminal window, change to the root directory of your app project, and run the following CLI command:
345345

346-
<code-example language="sh" class="code-shell">
346+
<code-example language="sh">
347347
ng extract-i18n
348348
</code-example>
349349

@@ -362,7 +362,7 @@ Angular 9 uses the source locale configured in your app's [workspace configurati
362362

363363
To create a file in the `src/locale` directory, specify the output path as an option, as shown in the following example:
364364

365-
<code-example language="sh" class="code-shell">
365+
<code-example language="sh">
366366
ng extract-i18n --output-path src/locale
367367
</code-example>
368368

@@ -378,7 +378,7 @@ The `extract-i18n` command can read and write files in three translation formats
378378

379379
Specify the translation format explicitly with the `--format` command option, as shown in the following examples:
380380

381-
<code-example language="sh" class="code-shell">
381+
<code-example language="sh">
382382
ng extract-i18n --format=xlf
383383
ng extract-i18n --format=xlf2
384384
ng extract-i18n --format=xmb
@@ -396,7 +396,7 @@ ng extract-i18n --format=xmb
396396
To change the name of the source language file generated by the extraction tool, use
397397
the `--outFile` command option:
398398

399-
<code-example language="sh" class="code-shell">
399+
<code-example language="sh">
400400
ng extract-i18n --out-file source.xlf
401401
</code-example>
402402

@@ -641,7 +641,7 @@ You can set the `"localize"` property as a shared configuration that all the con
641641
You can also use the `--localize` option with the [`ng build`](/cli/build "CLI reference for ng build") command and your existing `production` configuration.
642642
The CLI builds all locales defined in the build configuration, which is similar to setting the `"localize"` option to `true` as described in the previous section.
643643

644-
<code-example language="sh" class="code-shell">
644+
<code-example language="sh">
645645
ng build --localize
646646
</code-example>
647647

@@ -677,7 +677,7 @@ To apply specific build options to only one locale, you can create a custom loca
677677
You can then pass this configuration to the `ng serve` or `ng build` commands.
678678
The following shows how to serve the French language file created in the example for this guide:
679679

680-
<code-example language="sh" class="code-shell">
680+
<code-example language="sh">
681681
ng serve --configuration=fr
682682
</code-example>
683683

@@ -689,7 +689,7 @@ You can use the CLI development server (`ng serve`), but only with a single loca
689689

690690
For production builds, you can use configuration composition to execute both configurations:
691691

692-
<code-example language="sh" class="code-shell">
692+
<code-example language="sh">
693693
ng build --configuration=production,fr
694694
</code-example>
695695

aio/content/guide/lazy-loading-ngmodules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Create a resolver service.
267267
With the CLI, the command to generate a service is as follows:
268268

269269

270-
<code-example language="none" class="code-shell">
270+
<code-example language="sh">
271271
ng generate service <service-name>
272272
</code-example>
273273

aio/content/guide/npm-packages.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ The packages listed in the `devDependencies` section of `package.json` help you
102102

103103
To add a new `devDependency`, use either one of the following commands:
104104

105-
<code-example language="sh" class="code-shell">
105+
<code-example language="sh">
106106
npm install --save-dev &lt;package-name&gt;
107107
</code-example>
108108

109-
<code-example language="sh" class="code-shell">
109+
<code-example language="sh">
110110
yarn add --dev &lt;package-name&gt;
111111
</code-example>
112112

aio/content/guide/reactive-forms.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ To use reactive form controls, import `ReactiveFormsModule` from the `@angular/f
5050

5151
Use the [CLI command](cli "Using the Angular command-line interface.") `ng generate` to generate a component in your project to host the control.
5252

53-
<code-example language="sh" class="code-shell">
53+
<code-example language="sh">
5454

5555
ng generate component NameEditor
5656

@@ -146,7 +146,7 @@ Just as a form control instance gives you control over a single input field, a f
146146

147147
Generate a `ProfileEditor` component and import the `FormGroup` and `FormControl` classes from the `@angular/forms` package.
148148

149-
<code-example language="sh" class="code-shell">
149+
<code-example language="sh">
150150

151151
ng generate component ProfileEditor
152152

0 commit comments

Comments
 (0)