Skip to content

Commit f884c18

Browse files
MeAkibkirjs
authored andcommitted
docs: format JSON examples and replace <docs-code> with fenced code blocks
Replaced <docs-code language="json" for improved readability and consistency across documentation.
1 parent 68aa83e commit f884c18

6 files changed

Lines changed: 209 additions & 210 deletions

File tree

adev/src/content/ecosystem/service-workers/config.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,12 @@ If the field is omitted, it defaults to:
368368

369369
This optional property enables you to configure how the service worker handles navigation requests:
370370

371-
<docs-code language="json">
371+
```json
372372

373373
{
374-
"navigationRequestStrategy": "freshness"
374+
"navigationRequestStrategy": "freshness"
375375
}
376-
377-
</docs-code>
376+
```
378377

379378
| Possible values | Details |
380379
| :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

adev/src/content/guide/tailwind.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ Next, open a terminal in your Angular project's root directory and run the follo
5757
Next, add a `.postcssrc.json` file in the file root of the project.
5858
Add the `@tailwindcss/postcss` plugin into your PostCSS configuration.
5959

60-
<docs-code language="json" header=".postcssrc.json">
60+
```json {header: '.postcssrc.json'}
61+
6162
{
6263
"plugins": {
6364
"@tailwindcss/postcss": {}
6465
}
6566
}
66-
</docs-code>
67+
```
6768

6869
### 4. Import Tailwind CSS
6970

adev/src/content/reference/extended-diagnostics/overview.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,19 @@ Each diagnostic can be configured as either:
4040

4141
Check severity can be configured as an [Angular compiler option](reference/configs/angular-compiler-options):
4242

43-
<docs-code language="json">
43+
```json
44+
4445
{
4546
"angularCompilerOptions": {
4647
"extendedDiagnostics": {
47-
// The categories to use for specific diagnostics.
4848
"checks": {
49-
// Maps check name to its category.
5049
"invalidBananaInBox": "suppress"
5150
},
52-
53-
// The category to use for any diagnostics not listed in `checks` above.
5451
"defaultCategory": "error"
5552
}
56-
57-
}
53+
}
5854
}
59-
</docs-code>
55+
```
6056

6157
The `checks` field maps the name of individual diagnostics to their associated category.
6258
See [Diagnostics](#diagnostics) for a complete list of extended diagnostics and the name to use for configuring them.

adev/src/content/reference/versions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ relative to the current workspace or module specifier \(Example: `zone.js`\).
120120

121121
If you create a TypeScript file, make sure to include it in the `files` property of your `tsconfig` file.
122122

123-
<docs-code language="json">
123+
```json
124+
124125
{
125126
"extends": "./tsconfig.json",
126127
"compilerOptions": {
@@ -132,7 +133,7 @@ If you create a TypeScript file, make sure to include it in the `files` property
132133
]
133134
...
134135
}
135-
</docs-code>
136+
```
136137

137138
## Polyfills for non-CLI users
138139

adev/src/content/tools/cli/cli-builder.md

Lines changed: 85 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,21 @@ a `source` and a `destination`, each of which are a string.
104104

105105
You can provide the following schema for type validation of these values.
106106

107-
<docs-code header="src/schema.json" language="json">
107+
```json {header: "schema.json"}
108108

109109
{
110-
"$schema": "http://json-schema.org/schema",
111-
"type": "object",
112-
"properties": {
113-
"source": {
114-
"type": "string"
115-
},
116-
"destination": {
117-
"type": "string"
118-
}
119-
}
110+
"$schema": "http://json-schema.org/schema",
111+
"type": "object",
112+
"properties": {
113+
"source": {
114+
"type": "string"
115+
},
116+
"destination": {
117+
"type": "string"
118+
}
119+
}
120120
}
121-
122-
</docs-code>
121+
```
123122

124123
HELPFUL: This is a minimal example, but the use of a schema for validation can be very powerful.
125124
For more information, see the [JSON schemas website](http://json-schema.org).
@@ -128,36 +127,33 @@ To link our builder implementation with its schema and name, you need to create
128127

129128
Create a file named `builders.json` that looks like this:
130129

131-
<docs-code header="builders.json" language="json">
130+
```json {header: "builders.json"}
132131

133132
{
134-
"builders": {
135-
"copy": {
136-
"implementation": "./dist/my-builder.js",
137-
"schema": "./src/schema.json",
138-
"description": "Copies a file."
139-
}
140-
}
133+
"builders": {
134+
"copy": {
135+
"implementation": "./dist/my-builder.js",
136+
"schema": "./src/schema.json",
137+
"description": "Copies a file."
138+
}
139+
}
141140
}
142-
143-
</docs-code>
141+
```
144142

145143
In the `package.json` file, add a `builders` key that tells the Architect tool where to find our builder definition file.
146144

147-
<docs-code header="package.json" language="json">
148-
145+
```json {header: "package.json"}
149146
{
150-
"name": "@example/copy-file",
151-
"version": "1.0.0",
152-
"description": "Builder for copying files",
153-
"builders": "builders.json",
154-
"dependencies": {
155-
"@angular-devkit/architect": "~0.1200.0",
156-
"@angular-devkit/core": "^12.0.0"
157-
}
147+
"name": "@example/copy-file",
148+
"version": "1.0.0",
149+
"description": "Builder for copying files",
150+
"builders": "builders.json",
151+
"dependencies": {
152+
"@angular-devkit/architect": "~0.1200.0",
153+
"@angular-devkit/core": "^12.0.0"
154+
}
158155
}
159-
160-
</docs-code>
156+
```
161157

162158
The official name of our builder is now `@example/copy-file:copy`.
163159
The first part of this is the package name and the second part is the builder name as specified in the `builders.json` file.
@@ -177,41 +173,37 @@ Architect in the Angular CLI uses the target definition to resolve input options
177173
The `angular.json` file has a section for each project, and the "architect" section of each project configures targets for builders used by CLI commands such as 'build', 'test', and 'serve'.
178174
By default, for example, the `ng build` command runs the builder `@angular-devkit/build-angular:browser` to perform the build task, and passes in default option values as specified for the `build` target in `angular.json`.
179175

180-
<docs-code header="angular.json" language="json">
181-
182-
183-
184-
"myApp": {
185-
186-
"architect": {
187-
"build": {
188-
"builder": "@angular-devkit/build-angular:browser",
189-
"options": {
190-
"outputPath": "dist/myApp",
191-
"index": "src/index.html",
192-
193-
},
194-
"configurations": {
195-
"production": {
196-
"fileReplacements": [
176+
```json {header: "angular.json"}
197177
{
198-
"replace": "src/environments/environment.ts",
199-
"with": "src/environments/environment.prod.ts"
200-
}
201-
],
202-
"optimization": true,
203-
"outputHashing": "all",
204-
205-
}
206-
}
207-
},
208-
209-
}
178+
"myApp": {
179+
"...": "...",
180+
"architect": {
181+
"build": {
182+
"builder": "@angular-devkit/build-angular:browser",
183+
"options": {
184+
"outputPath": "dist/myApp",
185+
"index": "src/index.html",
186+
"...": "..."
187+
},
188+
"configurations": {
189+
"production": {
190+
"fileReplacements": [
191+
{
192+
"replace": "src/environments/environment.ts",
193+
"with": "src/environments/environment.prod.ts"
194+
}
195+
],
196+
"optimization": true,
197+
"outputHashing": "all",
198+
"...": "..."
199+
}
200+
}
201+
},
202+
"...": "..."
203+
}
204+
}
210205
}
211-
212-
213-
214-
</docs-code>
206+
```
215207

216208
The command passes the builder the set of default options specified in the "options" section.
217209
If you pass the `--configuration=production` flag, it uses the override values specified in the `production` configuration.
@@ -271,36 +263,33 @@ npm install @example/copy-file
271263

272264
If you create a new project with `ng new builder-test`, the generated `angular.json` file looks something like this, with only default builder configurations.
273265

274-
<docs-code header="angular.json" language="json">
275-
266+
```json {header: "angular.json"}
276267
{
277-
"projects": {
278-
"builder-test": {
279-
"architect": {
280-
"build": {
281-
"builder": "@angular-devkit/build-angular:browser",
282-
"options": {
283-
// more options...
284-
"outputPath": "dist/builder-test",
285-
"index": "src/index.html",
286-
"main": "src/main.ts",
287-
"polyfills": "src/polyfills.ts",
288-
"tsConfig": "src/tsconfig.app.json"
289-
},
290-
"configurations": {
291-
"production": {
292-
// more options...
293-
"optimization": true,
294-
"aot": true,
295-
"buildOptimizer": true
296-
}
297-
}
298-
}
299-
}
300-
}
301-
}
268+
"projects": {
269+
"builder-test": {
270+
"architect": {
271+
"build": {
272+
"builder": "@angular-devkit/build-angular:browser",
273+
"options": {
274+
"outputPath": "dist/builder-test",
275+
"index": "src/index.html",
276+
"main": "src/main.ts",
277+
"polyfills": "src/polyfills.ts",
278+
"tsConfig": "src/tsconfig.app.json"
279+
},
280+
"configurations": {
281+
"production": {
282+
"optimization": true,
283+
"aot": true,
284+
"buildOptimizer": true
285+
}
286+
}
287+
}
288+
}
289+
}
290+
}
302291
}
303-
</docs-code>
292+
```
304293

305294
### Adding a target
306295

0 commit comments

Comments
 (0)