From b9155b512175ede6ad56d69ccb04d556b293e589 Mon Sep 17 00:00:00 2001 From: hawkgs Date: Fri, 6 Dec 2024 14:55:46 +0200 Subject: [PATCH] docs: set syntax highlighting to the remaining Markdown code examples blocks (#59088) There are some code blocks that slipped through the initial Regex-es. Related to #59026 PR Close #59088 --- packages/common/http/src/request.ts | 2 +- .../ng_optimized_image/ng_optimized_image.ts | 2 +- .../src/ngtsc/diagnostics/src/error_code.ts | 2 +- .../src/ngtsc/reflection/src/host.ts | 8 ++-- .../src/ngtsc/reflection/src/typescript.ts | 4 +- .../src/ngtsc/typecheck/api/symbols.ts | 2 +- packages/compiler/src/core.ts | 23 +++++----- .../compiler/src/expression_parser/parser.ts | 6 +-- packages/compiler/src/render3/view/api.ts | 8 ++-- packages/compiler/src/shadow_css.ts | 8 ++-- .../src/template_parser/binding_parser.ts | 2 +- .../core/src/application/application_ref.ts | 4 +- .../differs/iterable_differs.ts | 2 +- .../differs/keyvalue_differs.ts | 2 +- .../scheduling/ng_zone_scheduling.ts | 4 +- packages/core/src/metadata/ng_module.ts | 2 +- packages/core/src/pending_tasks.ts | 4 +- packages/core/src/render3/definition.ts | 2 +- .../i18n_icu_container_visitor.ts | 2 +- .../render3/interfaces/attribute_marker.ts | 25 +++++------ .../core/src/render3/interfaces/injector.ts | 6 +-- packages/core/src/render3/interfaces/node.ts | 10 ++--- packages/core/src/render3/interfaces/view.ts | 10 ++--- packages/core/src/render3/state.ts | 4 +- .../directives/abstract_control_directive.ts | 4 +- packages/forms/src/model/abstract_model.ts | 6 +-- packages/forms/src/model/form_array.ts | 6 +-- packages/forms/src/model/form_group.ts | 6 +-- .../localize/src/localize/src/localize.ts | 2 +- .../platform-browser/animations/src/module.ts | 2 +- .../src/browser/tools/common_tools.ts | 2 +- .../src/directives/router_link_active.ts | 2 +- packages/router/src/models.ts | 14 +++---- packages/router/src/navigation_transition.ts | 2 +- packages/router/src/router.ts | 6 +-- packages/router/src/router_module.ts | 4 +- packages/router/src/router_state.ts | 2 +- .../src/dynamic/src/upgrade_adapter.ts | 14 +++---- .../zone.js/lib/zone.configurations.api.ts | 42 +++++++++---------- 39 files changed, 128 insertions(+), 130 deletions(-) diff --git a/packages/common/http/src/request.ts b/packages/common/http/src/request.ts index 25cc495e49a..3ea5b63a73a 100644 --- a/packages/common/http/src/request.ts +++ b/packages/common/http/src/request.ts @@ -170,7 +170,7 @@ export class HttpRequest { * To pass a string representation of HTTP parameters in the URL-query-string format, * the `HttpParamsOptions`' `fromString` may be used. For example: * - * ``` + * ```ts * new HttpParams({fromString: 'angular=awesome'}) * ``` */ diff --git a/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts b/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts index c7c347615cd..99d3f87a576 100644 --- a/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts +++ b/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts @@ -318,7 +318,7 @@ export class NgOptimizedImage implements OnInit, OnChanges { * descriptors to generate the final `srcset` property of the image. * * Example: - * ``` + * ```html * => * * ``` diff --git a/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts b/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts index 0240f4d65c6..a5013d246f9 100644 --- a/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts +++ b/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts @@ -273,7 +273,7 @@ export enum ErrorCode { * The left-hand side of an assignment expression was a template variable. Effectively, the * template looked like: * - * ``` + * ```html * * * diff --git a/packages/compiler-cli/src/ngtsc/reflection/src/host.ts b/packages/compiler-cli/src/ngtsc/reflection/src/host.ts index 9a13d26ff36..e3e02e09f14 100644 --- a/packages/compiler-cli/src/ngtsc/reflection/src/host.ts +++ b/packages/compiler-cli/src/ngtsc/reflection/src/host.ts @@ -153,7 +153,7 @@ export interface ClassMember { * * For example, the TS code: * - * ``` + * ```ts * class Clazz { * static get property(): string { * return 'value'; @@ -163,7 +163,7 @@ export interface ClassMember { * * Downlevels to: * - * ``` + * ```ts * var Clazz = (function () { * function Clazz() { * } @@ -182,7 +182,7 @@ export interface ClassMember { * Object.defineProperty ExpressionStatement, but the implementation would be this * FunctionDeclaration: * - * ``` + * ```ts * function () { * return 'value'; * }, @@ -624,7 +624,7 @@ export interface ReflectionHost { * If the declaration is in a different module, and that module is imported via an absolute path, * this method also returns the absolute path of the imported module. For example, if the code is: * - * ``` + * ```ts * import {RouterModule} from '@angular/core'; * * export const ROUTES = RouterModule.forRoot([...]); diff --git a/packages/compiler-cli/src/ngtsc/reflection/src/typescript.ts b/packages/compiler-cli/src/ngtsc/reflection/src/typescript.ts index 25034bb6201..afc16a40ce1 100644 --- a/packages/compiler-cli/src/ngtsc/reflection/src/typescript.ts +++ b/packages/compiler-cli/src/ngtsc/reflection/src/typescript.ts @@ -319,13 +319,13 @@ export class TypeScriptReflectionHost implements ReflectionHost { * * For example, if the identifier is the `Directive` part of a qualified type chain like: * - * ``` + * ```ts * core.Directive * ``` * * then it might be that `core` is a namespace import such as: * - * ``` + * ```ts * import * as core from 'tslib'; * ``` * diff --git a/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.ts b/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.ts index 7dc284733cb..935518f5cf3 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.ts @@ -190,7 +190,7 @@ export interface ReferenceSymbol { /** * The location in the shim file of a variable that holds the type of the local ref. * For example, a reference declaration like the following: - * ``` + * ```ts * var _t1 = document.createElement('div'); * var _t2 = _t1; // This is the reference declaration * ``` diff --git a/packages/compiler/src/core.ts b/packages/compiler/src/core.ts index 2af6d170b9a..a0a2d6d352c 100644 --- a/packages/compiler/src/core.ts +++ b/packages/compiler/src/core.ts @@ -221,12 +221,12 @@ export const enum AttributeMarker { * ## Example: * * Given: - * ``` - *
... + * ```html + *
...
* ``` * * the generated code is: - * ``` + * ```ts * var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz']; * ``` */ @@ -240,12 +240,12 @@ export const enum AttributeMarker { * ## Example: * * Given: - * ``` + * ```html *
...
* ``` * * the generated code is: - * ``` + * ```ts * var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red']; * ``` */ @@ -256,13 +256,13 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *
* ``` * * the generated code is: * - * ``` + * ```ts * var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar']; * ``` */ @@ -273,7 +273,7 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *
* ``` * @@ -298,7 +298,7 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *

* ``` * @@ -315,14 +315,15 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *
* ``` * * the generated code is: * - * ``` + * ```ts * var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar']; + * ``` */ I18n = 6, } diff --git a/packages/compiler/src/expression_parser/parser.ts b/packages/compiler/src/expression_parser/parser.ts index 429626ff5ec..7d0013e57ef 100644 --- a/packages/compiler/src/expression_parser/parser.ts +++ b/packages/compiler/src/expression_parser/parser.ts @@ -176,7 +176,7 @@ export class Parser { * parsing errors in case the given expression is invalid. * * For example, - * ``` + * ```html *
* ^ ^ absoluteValueOffset for `templateValue` * absoluteKeyOffset for `templateKey` @@ -187,7 +187,7 @@ export class Parser { * 3. ngForOf -> items * * This is apparent from the de-sugared template: - * ``` + * ```html * * ``` * @@ -1215,7 +1215,7 @@ class _ParseAST { * parsing errors in case the given expression is invalid. * * For example, - * ``` + * ```html *
* ``` * contains five bindings: diff --git a/packages/compiler/src/render3/view/api.ts b/packages/compiler/src/render3/view/api.ts index 3643d997aed..dff2cfbd75e 100644 --- a/packages/compiler/src/render3/view/api.ts +++ b/packages/compiler/src/render3/view/api.ts @@ -156,7 +156,7 @@ export const enum DeclarationListEmitMode { /** * The list of declarations is emitted into the generated code as is. * - * ``` + * ```ts * directives: [MyDir], * ``` */ @@ -166,7 +166,7 @@ export const enum DeclarationListEmitMode { * The list of declarations is emitted into the generated code wrapped inside a closure, which * is needed when at least one declaration is a forward reference. * - * ``` + * ```ts * directives: function () { return [MyDir, ForwardDir]; }, * ``` */ @@ -180,13 +180,13 @@ export const enum DeclarationListEmitMode { * any forward references within the list are resolved when the outer closure is invoked. * * Consider the case where the runtime has captured two declarations in two distinct values: - * ``` + * ```ts * const dirA = MyDir; * const dirB = forwardRef(function() { return ForwardRef; }); * ``` * * This mode would emit the declarations captured in `dirA` and `dirB` as follows: - * ``` + * ```ts * directives: function () { return [dirA, dirB].map(ng.resolveForwardRef); }, * ``` */ diff --git a/packages/compiler/src/shadow_css.ts b/packages/compiler/src/shadow_css.ts index 0a40a35f67f..f8548db07f1 100644 --- a/packages/compiler/src/shadow_css.ts +++ b/packages/compiler/src/shadow_css.ts @@ -214,7 +214,7 @@ export class ShadowCss { * * For example, we convert this css: * - * ``` + * ```scss * .box { * animation: box-animation 1s forwards; * } @@ -228,7 +228,7 @@ export class ShadowCss { * * to this: * - * ``` + * ```scss * .box { * animation: scopeName_box-animation 1s forwards; * } @@ -262,7 +262,7 @@ export class ShadowCss { * * For example, it takes a rule such as: * - * ``` + * ```scss * @keyframes box-animation { * to { * background-color: green; @@ -272,7 +272,7 @@ export class ShadowCss { * * and returns: * - * ``` + * ```scss * @keyframes scopeName_box-animation { * to { * background-color: green; diff --git a/packages/compiler/src/template_parser/binding_parser.ts b/packages/compiler/src/template_parser/binding_parser.ts index 52ed145016c..136b36a579d 100644 --- a/packages/compiler/src/template_parser/binding_parser.ts +++ b/packages/compiler/src/template_parser/binding_parser.ts @@ -263,7 +263,7 @@ export class BindingParser { /** * Parses the bindings in a microsyntax expression, e.g. - * ``` + * ```html * * ``` * diff --git a/packages/core/src/application/application_ref.ts b/packages/core/src/application/application_ref.ts index 50bc3e24ffb..c590a4b7eb5 100644 --- a/packages/core/src/application/application_ref.ts +++ b/packages/core/src/application/application_ref.ts @@ -116,7 +116,7 @@ export interface BootstrapOptions { * Optionally specify coalescing event change detections or not. * Consider the following case. * - * ``` + * ```html *
* *
@@ -140,7 +140,7 @@ export interface BootstrapOptions { * into a single change detection. * * Consider the following case. - * ``` + * ```ts * for (let i = 0; i < 10; i ++) { * ngZone.run(() => { * // do something diff --git a/packages/core/src/change_detection/differs/iterable_differs.ts b/packages/core/src/change_detection/differs/iterable_differs.ts index 4e943c0f47c..e212d4845ae 100644 --- a/packages/core/src/change_detection/differs/iterable_differs.ts +++ b/packages/core/src/change_detection/differs/iterable_differs.ts @@ -222,7 +222,7 @@ export class IterableDiffers { * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {@link IterableDiffer} available. * - * ``` + * ```ts * @Component({ * viewProviders: [ * IterableDiffers.extend([new ImmutableListDiffer()]) diff --git a/packages/core/src/change_detection/differs/keyvalue_differs.ts b/packages/core/src/change_detection/differs/keyvalue_differs.ts index 11f74458148..6656f4aad3a 100644 --- a/packages/core/src/change_detection/differs/keyvalue_differs.ts +++ b/packages/core/src/change_detection/differs/keyvalue_differs.ts @@ -155,7 +155,7 @@ export class KeyValueDiffers { * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {@link KeyValueDiffer} available. * - * ``` + * ```ts * @Component({ * viewProviders: [ * KeyValueDiffers.extend([new ImmutableMapDiffer()]) diff --git a/packages/core/src/change_detection/scheduling/ng_zone_scheduling.ts b/packages/core/src/change_detection/scheduling/ng_zone_scheduling.ts index 381d4b3191e..add6171bab4 100644 --- a/packages/core/src/change_detection/scheduling/ng_zone_scheduling.ts +++ b/packages/core/src/change_detection/scheduling/ng_zone_scheduling.ts @@ -181,7 +181,7 @@ export interface NgZoneOptions { * Optionally specify coalescing event change detections or not. * Consider the following case. * - * ``` + * ```html *
* *
@@ -204,7 +204,7 @@ export interface NgZoneOptions { * into a single change detection. * * Consider the following case. - * ``` + * ```ts * for (let i = 0; i < 10; i ++) { * ngZone.run(() => { * // do something diff --git a/packages/core/src/metadata/ng_module.ts b/packages/core/src/metadata/ng_module.ts index 38d32839e28..841eb4aa39f 100644 --- a/packages/core/src/metadata/ng_module.ts +++ b/packages/core/src/metadata/ng_module.ts @@ -57,7 +57,7 @@ export interface NgModule { * The following example defines a class that is injected in * the HelloWorld NgModule: * - * ``` + * ```ts * class Greeter { * greet(name:string) { * return 'Hello ' + name + '!'; diff --git a/packages/core/src/pending_tasks.ts b/packages/core/src/pending_tasks.ts index b9042a81bbe..fa859a54c9a 100644 --- a/packages/core/src/pending_tasks.ts +++ b/packages/core/src/pending_tasks.ts @@ -107,7 +107,7 @@ export class PendingTasks { /** * Runs an asynchronous function and blocks the application's stability until the function completes. * - * ``` + * ```ts * pendingTasks.run(async () => { * const userData = await fetch('/api/user'); * this.userData.set(userData); @@ -117,7 +117,7 @@ export class PendingTasks { * Application stability is at least delayed until the next tick after the `run` method resolves * so it is safe to make additional updates to application state that would require UI synchronization: * - * ``` + * ```ts * const userData = await pendingTasks.run(() => fetch('/api/user')); * this.userData.set(userData); * ``` diff --git a/packages/core/src/render3/definition.ts b/packages/core/src/render3/definition.ts index 6b022c06d14..946afb68a4f 100644 --- a/packages/core/src/render3/definition.ts +++ b/packages/core/src/render3/definition.ts @@ -242,7 +242,7 @@ interface ComponentDefinition extends Omit, 'features' * * This function has following structure. * - * ``` + * ```ts * function Template(ctx:T, creationMode: boolean) { * if (creationMode) { * // Contains creation mode instructions. diff --git a/packages/core/src/render3/instructions/i18n_icu_container_visitor.ts b/packages/core/src/render3/instructions/i18n_icu_container_visitor.ts index 993a7afc7e8..111a3a72045 100644 --- a/packages/core/src/render3/instructions/i18n_icu_container_visitor.ts +++ b/packages/core/src/render3/instructions/i18n_icu_container_visitor.ts @@ -74,7 +74,7 @@ export function loadIcuContainerVisitor() { * to determine which root belong to the ICU. * * Example of usage. - * ``` + * ```ts * const nextRNode = icuContainerIteratorStart(tIcuContainerNode, lView); * let rNode: RNode|null; * while(rNode = nextRNode()) { diff --git a/packages/core/src/render3/interfaces/attribute_marker.ts b/packages/core/src/render3/interfaces/attribute_marker.ts index 4b2e4261c03..4be81ce23bb 100644 --- a/packages/core/src/render3/interfaces/attribute_marker.ts +++ b/packages/core/src/render3/interfaces/attribute_marker.ts @@ -34,12 +34,12 @@ export const enum AttributeMarker { * ## Example: * * Given: - * ``` - *
... + * ```html + *
...
* ``` * * the generated code is: - * ``` + * ```ts * var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz']; * ``` */ @@ -53,12 +53,12 @@ export const enum AttributeMarker { * ## Example: * * Given: - * ``` + * ```html *
...
* ``` * * the generated code is: - * ``` + * ```ts * var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red']; * ``` */ @@ -69,13 +69,13 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *
* ``` * * the generated code is: * - * ``` + * ```ts * var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar']; * ``` */ @@ -86,7 +86,7 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *
* ``` * @@ -112,13 +112,13 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *

* ``` * * the generated code for the `element()` instruction would include: * - * ``` + * ```ts * ['attr', 'value', AttributeMarker.ProjectAs, ['', 'title', '']] * ``` */ @@ -129,14 +129,15 @@ export const enum AttributeMarker { * * For example, given the following HTML: * - * ``` + * ```html *
* ``` * * the generated code is: * - * ``` + * ```ts * var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar']; + * ``` */ I18n = 6, } diff --git a/packages/core/src/render3/interfaces/injector.ts b/packages/core/src/render3/interfaces/injector.ts index 6d51b13544c..da035a2f984 100644 --- a/packages/core/src/render3/interfaces/injector.ts +++ b/packages/core/src/render3/interfaces/injector.ts @@ -202,7 +202,7 @@ export class NodeInjectorFactory { * Example: * * If we have a component and directive active an a single element as declared here - * ``` + * ```ts * component: * providers: [ {provide: String, useValue: 'component', multi: true} ], * viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ], @@ -213,7 +213,7 @@ export class NodeInjectorFactory { * * Then the expected results are: * - * ``` + * ```ts * providers: ['component', 'directive'] * viewProviders: ['component', 'componentView', 'directive'] * ``` @@ -238,7 +238,7 @@ export class NodeInjectorFactory { * Example: * * Given: - * ``` + * ```ts * providers: [ {provide: String, useValue: 'all', multi: true} ], * viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ], * ``` diff --git a/packages/core/src/render3/interfaces/node.ts b/packages/core/src/render3/interfaces/node.ts index 62e94bd828a..b106d062703 100644 --- a/packages/core/src/render3/interfaces/node.ts +++ b/packages/core/src/render3/interfaces/node.ts @@ -244,7 +244,7 @@ export interface TNode { * such a case the value stores an array of text nodes to insert. * * Example: - * ``` + * ```html *
* Hello World! *
@@ -257,7 +257,7 @@ export interface TNode { * `` itself. * * Pseudo code: - * ``` + * ```ts * if (insertBeforeIndex === null) { * // append as normal * } else if (Array.isArray(insertBeforeIndex)) { @@ -490,12 +490,12 @@ export interface TNode { * * For easier discussion assume this example: * ``'s view definition: - * ``` + * ```html * content1 * content2 * ``` * ``'s view definition: - * ``` + * ```html * * ``` * @@ -558,7 +558,7 @@ export interface TNode { * styling than the instruction. * * Imagine: - * ``` + * ```angular-ts *
* * @Directive({ diff --git a/packages/core/src/render3/interfaces/view.ts b/packages/core/src/render3/interfaces/view.ts index 9a22a958927..f9a76db109f 100644 --- a/packages/core/src/render3/interfaces/view.ts +++ b/packages/core/src/render3/interfaces/view.ts @@ -139,7 +139,7 @@ export interface LView extends Array { * Store the `TNode` of the location where the current `LView` is inserted into. * * Given: - * ``` + * ```html *
* *
@@ -154,7 +154,7 @@ export interface LView extends Array { * insertion information in the `TView` and instead we must store it in the `LView[T_HOST]`. * * So to determine where is our insertion parent we would execute: - * ``` + * ```ts * const parentLView = lView[PARENT]; * const parentTNode = lView[T_HOST]; * const insertionParent = parentLView[parentTNode.index]; @@ -249,7 +249,7 @@ export interface LView extends Array { * `DECLARATION_VIEW`. * * Example: - * ``` + * ```html * <#VIEW #myComp> *
* ... @@ -274,7 +274,7 @@ export interface LView extends Array { * `DECLARATION_COMPONENT_VIEW` to differentiate them. As in this example. * * Example showing intra component `LView` movement. - * ``` + * ```html * <#VIEW #myComp> *
* Content to render when condition is true. @@ -284,7 +284,7 @@ export interface LView extends Array { * The `thenBlock` and `elseBlock` is moved but not transplanted. * * Example showing inter component `LView` movement (transplanted view). - * ``` + * ```html * <#VIEW #myComp> * ... * diff --git a/packages/core/src/render3/state.ts b/packages/core/src/render3/state.ts index 32c007a29ad..53b719ee85a 100644 --- a/packages/core/src/render3/state.ts +++ b/packages/core/src/render3/state.ts @@ -176,7 +176,7 @@ interface InstructionState { * directives on children of that element. * * Example: - * ``` + * ```html * * Should match component / directive. * @@ -193,7 +193,7 @@ interface InstructionState { * Stores the root TNode that has the 'ngSkipHydration' attribute on it for later reference. * * Example: - * ``` + * ```html * * Should reference this root node * diff --git a/packages/forms/src/directives/abstract_control_directive.ts b/packages/forms/src/directives/abstract_control_directive.ts index 120d33bae05..fe0911ec344 100644 --- a/packages/forms/src/directives/abstract_control_directive.ts +++ b/packages/forms/src/directives/abstract_control_directive.ts @@ -278,7 +278,7 @@ export abstract class AbstractControlDirective { * @usageNotes * For example, for the following `FormGroup`: * - * ``` + * ```ts * form = new FormGroup({ * address: new FormGroup({ street: new FormControl() }) * }); @@ -312,7 +312,7 @@ export abstract class AbstractControlDirective { * @usageNotes * For example, for the following `FormGroup`: * - * ``` + * ```ts * form = new FormGroup({ * address: new FormGroup({ street: new FormControl() }) * }); diff --git a/packages/forms/src/model/abstract_model.ts b/packages/forms/src/model/abstract_model.ts index c7d4360c133..f5624933c1f 100644 --- a/packages/forms/src/model/abstract_model.ts +++ b/packages/forms/src/model/abstract_model.ts @@ -1430,7 +1430,7 @@ export abstract class AbstractControl = any> extends Abst * @usageNotes * ### Set the values for the controls in the form array * - * ``` + * ```ts * const arr = new FormArray([ * new FormControl(), * new FormControl() @@ -322,7 +322,7 @@ export class FormArray = any> extends Abst * @usageNotes * ### Patch the values for controls in a form array * - * ``` + * ```ts * const arr = new FormArray([ * new FormControl(), * new FormControl() @@ -388,7 +388,7 @@ export class FormArray = any> extends Abst * * ### Reset the values in a form array and the disabled status for the first control * - * ``` + * ```ts * arr.reset([ * {value: 'name', disabled: true}, * 'last' diff --git a/packages/forms/src/model/form_group.ts b/packages/forms/src/model/form_group.ts index ab4d126857e..9841893df00 100644 --- a/packages/forms/src/model/form_group.ts +++ b/packages/forms/src/model/form_group.ts @@ -381,7 +381,7 @@ export class FormGroup< * @usageNotes * ### Set the complete value for the form group * - * ``` + * ```ts * const form = new FormGroup({ * first: new FormControl(), * last: new FormControl() @@ -437,7 +437,7 @@ export class FormGroup< * @usageNotes * ### Patch the value for a form group * - * ``` + * ```ts * const form = new FormGroup({ * first: new FormControl(), * last: new FormControl() @@ -528,7 +528,7 @@ export class FormGroup< * * ### Reset the form group values and disabled status * - * ``` + * ```ts * const form = new FormGroup({ * first: new FormControl('first name'), * last: new FormControl('last name') diff --git a/packages/localize/src/localize/src/localize.ts b/packages/localize/src/localize/src/localize.ts index e862d91a7f9..117f17486ec 100644 --- a/packages/localize/src/localize/src/localize.ts +++ b/packages/localize/src/localize/src/localize.ts @@ -28,7 +28,7 @@ export interface LocalizeFn { * * The compile-time translation inliner is able to replace the following code: * - * ``` + * ```ts * typeof $localize !== "undefined" && $localize.locale * ``` * diff --git a/packages/platform-browser/animations/src/module.ts b/packages/platform-browser/animations/src/module.ts index 14d4a19a7a9..9c514a6bcff 100644 --- a/packages/platform-browser/animations/src/module.ts +++ b/packages/platform-browser/animations/src/module.ts @@ -46,7 +46,7 @@ export class BrowserAnimationsModule { * @usageNotes * When registering the `BrowserAnimationsModule`, you can use the `withConfig` * function as follows: - * ``` + * ```ts * @NgModule({ * imports: [BrowserAnimationsModule.withConfig(config)] * }) diff --git a/packages/platform-browser/src/browser/tools/common_tools.ts b/packages/platform-browser/src/browser/tools/common_tools.ts index bf3fc651f25..d9133c1a645 100644 --- a/packages/platform-browser/src/browser/tools/common_tools.ts +++ b/packages/platform-browser/src/browser/tools/common_tools.ts @@ -39,7 +39,7 @@ export class AngularProfiler { * `record` (boolean) - causes the profiler to record a CPU profile while * it exercises the change detector. Example: * - * ``` + * ```ts * ng.profiler.timeChangeDetection({record: true}) * ``` */ diff --git a/packages/router/src/directives/router_link_active.ts b/packages/router/src/directives/router_link_active.ts index f6162f7ebb4..4d2f6b82f14 100644 --- a/packages/router/src/directives/router_link_active.ts +++ b/packages/router/src/directives/router_link_active.ts @@ -143,7 +143,7 @@ export class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit * true -> Route is active * false -> Route is inactive * - * ``` + * ```html * { * constructor(private permissions: Permissions, private currentUser: UserToken) {} @@ -1071,8 +1070,7 @@ export type CanDeactivateFn = ( * Here, the defined guard function is provided as part of the `Route` object * in the router configuration: * - * ``` - * + * ```ts * @NgModule({ * imports: [ * RouterModule.forRoot([ @@ -1151,8 +1149,7 @@ export type CanMatchFn = (route: Route, segments: UrlSegment[]) => MaybeAsync = ( * Here, the defined guard function is provided as part of the `Route` object * in the router configuration: * - * ``` - * + * ```ts * @NgModule({ * imports: [ * RouterModule.forRoot([ @@ -1497,7 +1493,7 @@ export interface NavigationBehaviorOptions { * This feature is useful for redirects, such as redirecting to an error page, without changing * the value that will be displayed in the browser's address bar. * - * ``` + * ```ts * const canActivate: CanActivateFn = (route: ActivatedRouteSnapshot) => { * const userService = inject(UserService); * const router = inject(Router); diff --git a/packages/router/src/navigation_transition.ts b/packages/router/src/navigation_transition.ts index f209a3a9854..e2d94d8ff3c 100644 --- a/packages/router/src/navigation_transition.ts +++ b/packages/router/src/navigation_transition.ts @@ -124,7 +124,7 @@ export interface UrlCreationOptions { * The following `go()` function navigates to the `list` route by * interpreting the destination URI as relative to the activated `child` route * - * ``` + * ```ts * @Component({...}) * class ChildComponent { * constructor(private router: Router, private route: ActivatedRoute) {} diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index ca305559117..12cb111ed11 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -355,7 +355,7 @@ export class Router { * * @usageNotes * - * ``` + * ```ts * router.resetConfig([ * { path: 'team/:id', component: TeamCmp, children: [ * { path: 'simple', component: SimpleCmp }, @@ -498,7 +498,7 @@ export class Router { * * The following calls request navigation to an absolute path. * - * ``` + * ```ts * router.navigateByUrl("/team/33/user/11"); * * // Navigate without updating the URL @@ -540,7 +540,7 @@ export class Router { * * The following calls request navigation to a dynamic route path relative to the current URL. * - * ``` + * ```ts * router.navigate(['team', 33, 'user', 11], {relativeTo: route}); * * // Navigate without updating the URL, overriding the default behavior diff --git a/packages/router/src/router_module.ts b/packages/router/src/router_module.ts index f1477362bb8..7fe1bbf4fae 100644 --- a/packages/router/src/router_module.ts +++ b/packages/router/src/router_module.ts @@ -120,7 +120,7 @@ export class RouterModule { * * When registering the NgModule at the root, import as follows: * - * ``` + * ```ts * @NgModule({ * imports: [RouterModule.forRoot(ROUTES)] * }) @@ -171,7 +171,7 @@ export class RouterModule { * without creating a new Router service. * When registering for submodules and lazy-loaded submodules, create the NgModule as follows: * - * ``` + * ```ts * @NgModule({ * imports: [RouterModule.forChild(ROUTES)] * }) diff --git a/packages/router/src/router_state.ts b/packages/router/src/router_state.ts index ea88e9850fa..00deff77de2 100644 --- a/packages/router/src/router_state.ts +++ b/packages/router/src/router_state.ts @@ -349,7 +349,7 @@ export class ActivatedRouteSnapshot { * You can compute all params (or data) in the router state or to get params outside * of an activated component by traversing the `RouterState` tree as in the following * example: - * ``` + * ```ts * collectRouteParams(router: Router) { * let params = {}; * let stack: ActivatedRouteSnapshot[] = [router.routerState.snapshot.root]; diff --git a/packages/upgrade/src/dynamic/src/upgrade_adapter.ts b/packages/upgrade/src/dynamic/src/upgrade_adapter.ts index 3d83bae4729..fda4d24d0f0 100644 --- a/packages/upgrade/src/dynamic/src/upgrade_adapter.ts +++ b/packages/upgrade/src/dynamic/src/upgrade_adapter.ts @@ -198,7 +198,7 @@ export class UpgradeAdapter { * * ### Example * - * ``` + * ```angular-ts * const adapter = new UpgradeAdapter(forwardRef(() => MyNg2Module)); * const module = angular.module('myExample', []); * module.directive('greet', adapter.downgradeNg2Component(Greeter)); @@ -277,7 +277,7 @@ export class UpgradeAdapter { * * ### Example * - * ``` + * ```angular-ts * const adapter = new UpgradeAdapter(forwardRef(() => MyNg2Module)); * const module = angular.module('myExample', []); * @@ -327,7 +327,7 @@ export class UpgradeAdapter { * @usageNotes * ### Example * - * ``` + * ```ts * const upgradeAdapter = new UpgradeAdapter(MyNg2Module); * * // configure the adapter with upgrade/downgrade components and services @@ -386,7 +386,7 @@ export class UpgradeAdapter { * @usageNotes * ### Example * - * ``` + * ```angular-ts * const adapter = new UpgradeAdapter(MyNg2Module); * const module = angular.module('myExample', []); * module.directive('ng2', adapter.downgradeNg2Component(Ng2)); @@ -467,7 +467,7 @@ export class UpgradeAdapter { * @usageNotes * ### Example * - * ``` + * ```ts * class Login { ... } * class Server { ... } * @@ -507,7 +507,7 @@ export class UpgradeAdapter { * @usageNotes * ### Example * - * ``` + * ```ts * class Example { * } * @@ -538,7 +538,7 @@ export class UpgradeAdapter { * @usageNotes * ### Example * - * ``` + * ```ts * const upgradeAdapter = new UpgradeAdapter(MyNg2Module); * upgradeAdapter.declareNg1Module(['heroApp']); * ``` diff --git a/packages/zone.js/lib/zone.configurations.api.ts b/packages/zone.js/lib/zone.configurations.api.ts index 6c209625300..652c062cf55 100644 --- a/packages/zone.js/lib/zone.configurations.api.ts +++ b/packages/zone.js/lib/zone.configurations.api.ts @@ -22,7 +22,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const EventEmitter = require('events'); * class MyEmitter extends EventEmitter {} * const myEmitter = new MyEmitter(); @@ -52,7 +52,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const fs = require('fs'); * * const zone = Zone.current.fork({name: 'myZone'}); @@ -80,7 +80,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * setTimeout(() => { @@ -106,7 +106,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * process.nextTick(() => { @@ -132,7 +132,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const crypto = require('crypto'); * * const zone = Zone.current.fork({name: 'myZone'}); @@ -182,7 +182,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const proto = Object.create(HTMLElement.prototype); * proto.createdCallback = function() { * console.log('createdCallback is invoked in the zone', Zone.current.name); @@ -225,7 +225,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * div.addEventListener('click', () => { @@ -251,7 +251,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * setTimeout(() => { @@ -279,7 +279,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * requestAnimationFrame(() => { @@ -310,7 +310,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * queueMicrotask(() => { @@ -342,7 +342,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * div.addEventListener('click', () => { @@ -382,7 +382,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * zone.run(() => { * div.onclick = () => { @@ -407,7 +407,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * class TestCustomElement extends HTMLElement { * constructor() { super(); } * connectedCallback() {} @@ -443,7 +443,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({ * name: 'myZone', * onScheduleTask: (delegate, curr, target, task) => { @@ -477,7 +477,7 @@ declare global { * * Consider the following examples: * - * ``` + * ```ts * const zone = Zone.current.fork({ * name: 'myZone' * }); @@ -506,7 +506,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * const zone = Zone.current.fork({ * name: 'myZone' * }); @@ -533,7 +533,7 @@ declare global { * * Consider the following examples: * - * ``` + * ```ts * const zone = Zone.current.fork({name: 'myZone'}); * * const p = Promise.resolve(1); @@ -716,7 +716,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * describe('jasmine.clock integration', () => { * beforeEach(() => { * jasmine.clock().install(); @@ -749,7 +749,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * describe('jasmine.clock integration', () => { * beforeEach(() => { * jasmine.clock().install(); @@ -774,7 +774,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * describe('jasmine.clock integration', () => { * beforeEach(() => { * jasmine.clock().install(); @@ -803,7 +803,7 @@ declare global { * * Consider the following example: * - * ``` + * ```ts * describe('wait never resolved promise', () => { * it('async with never resolved promise test', async(() => { * const p = new Promise(() => {});