Skip to content

Commit 14a2eac

Browse files
authored
Merge pull request #256 from IgniteUI/vkombov/configure-apilink-index-resolution
Add local ApiLink registry snapshots
1 parent 09b9123 commit 14a2eac

943 files changed

Lines changed: 34079 additions & 19090 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.md text eol=lf
2+
*.mdx text eol=lf

.github/CONTRIBUTING.md

Lines changed: 114 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
### 7. [Sample / Code View Configuration](#code-view-configuration)
99
### 8. [PlatformBlock usage](#platform-block)
1010
### 9. [ApiLink usage](#api-link)
11-
### 10. [Creating shared help topics](#creating-shared-help-topics)
12-
### 11. [Updating of Data Visualization related topics](#updating-of-data-visualization-related-topics)
13-
### 12. [Adding of images](#adding-of-images-in-the-topic)
11+
### 10. [Checking MDX API Links](#checking-api-links)
12+
### 11. [ApiLink registry workflow](#api-link-registry-workflow)
13+
### 12. [Creating shared help topics](#creating-shared-help-topics)
14+
### 13. [Updating of Data Visualization related topics](#updating-of-data-visualization-related-topics)
15+
### 14. [Adding of images](#adding-of-images-in-the-topic)
1416

1517
# <a name='#repository-overview'>Repository overview</a>
1618

@@ -251,7 +253,7 @@ Usage:
251253
| `height` | no | `400` | Height of the sample widget in pixels (numeric JSX expression, e.g. `{600}`). |
252254
| `alt` | no | `""` | Accessible label for the iframe. Use the `{Platform}` token so it resolves per-platform. |
253255
| `lob` | no | `false` | Use `lobDemosBaseUrl` as the base URL (for LOB / grid-dynamic demos). |
254-
| `dv` | no | `false` | Force `dvDemosBaseUrl` for samples whose path does not start with a recognised DV prefix. |
256+
| `dv` | no | `false` | Force `dvDemosBaseUrl` for samples whose path does not start with a recognized DV prefix. |
255257
| `crm` | no | `false` | Use `crmDemoBaseUrl` (for CRM demo samples). |
256258
| `iframeOnly` | no | `false` | Render only the iframe — hides the navbar, code tabs, and live-edit footer. |
257259
| `fullscreenBtn` | no | `false` | When used together with `iframeOnly={true}`, adds an "Open in full screen" button below the iframe. |
@@ -312,30 +314,131 @@ import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
312314
Basic syntax:
313315

314316
```mdx
315-
<ApiLink pkg="grids" type="Grid" />
316-
<ApiLink pkg="grids" type="Column" member="sortable" />
317+
<ApiLink type="Grid" />
318+
<ApiLink type="Column" member="sortable" />
317319
<ApiLink pkg="gauges" type="BulletGraph" label="Bullet Graph" />
318320
```
319321

320322
Key attributes:
321323

322324
| Attribute | Required | Notes |
323325
|---|---|---|
324-
| `pkg` | yes | Package key: `"grids"`, `"core"`, `"charts"`, `"gauges"`, `"excel"`, etc. |
326+
| `pkg` | no | Package key such as `"core"`, `"grids"`, `"charts"`, `"inputs"`, `"excel"`, or `"geo-core"`. Add it only when the registry has multiple valid matches and the package must be explicit. |
325327
| `type` | yes | Short type name **without** platform prefix — e.g. `"Grid"`, not `"IgrGrid"`. |
326-
| `kind` | for non-classes | TypeDoc kind: omit for classes. Use `"enum"`, `"interface"`, or `"typeAlias"` otherwise. |
328+
| `kind` | for non-classes | API kind. Omit for classes. Use `"enum"`, `"interface"`, `"type"`, `"function"`, or `"variable"` when the registry symbol is not a class. |
327329
| `member` | no | Property or method name for anchor links. |
328330
| `prefixed` | no | Default `true` (adds `Igr`/`Igx`/`Igc`/`Igb`). Set `{false}` for excel types and when `type` already contains `{ComponentName}`. |
329-
| `exclude` | no | Comma-separated platforms to show as inline code instead of a link (e.g. `exclude="Blazor"`). Use when the type does not exist on those platforms. |
331+
| `suffix` | no | Default `true` for component-style symbols. Set `{false}` for utility classes, strategy classes, and excel types that do not have an Angular `Component` suffix. |
330332
| `label` | no | Override the display text. |
331333

334+
`ApiLink` resolves through the generated API symbol registry. Keep links minimal when the registry can resolve a single target:
335+
336+
```mdx
337+
<ApiLink type="Calendar" />
338+
<ApiLink type="Grid" member="filter" />
339+
```
340+
341+
Add `pkg` only when the same symbol exists in more than one package:
342+
343+
```mdx
344+
<ApiLink pkg="core" type="Calendar" />
345+
<ApiLink pkg="inputs" type="CheckboxChangeEventArgs" />
346+
<ApiLink pkg="geo-core" type="NumberFormatSpecifier" />
347+
```
348+
349+
Add `kind` only when the intended symbol is not a class, or when the same name exists as multiple API kinds:
350+
351+
```mdx
352+
<ApiLink kind="enum" type="TransactionType" />
353+
```
354+
355+
If one `ApiLink` cannot be correct for all platforms, split the content with `PlatformBlock` instead of forcing one set of props to mean different targets.
356+
357+
Member lookup is case-insensitive, but after a member is found the registry is the source of truth for the rendered member name and anchor.
358+
332359
Also declare the types in the frontmatter so the auto-generated API reference grid works:
333360

334361
```yaml
335362
mentionedTypes: ["Grid", "Column"]
336363
```
337364
338-
For a complete reference see [AI-AGENT-API-LINKS.md](../docs/xplat/AI-AGENT-API-LINKS.md).
365+
For a complete editing reference see [AI-AGENT-API-LINKS.md](../docs/xplat/AI-AGENT-API-LINKS.md). For the registry and checker flow, see [API-LINK-WORKFLOW.md](../API-LINK-WORKFLOW.md).
366+
367+
# <a name='#checking-api-links'>Checking MDX API Links</a>
368+
369+
Use the root `check-mdx-links` scripts to validate `ApiLink` references:
370+
371+
| Scope | Command |
372+
|---|---|
373+
| All MDX sources | `npm run check-mdx-links` |
374+
| Angular docs | `npm run check-mdx-links:angular` |
375+
| React xplat docs | `npm run check-mdx-links:react` |
376+
| Web Components xplat docs | `npm run check-mdx-links:wc` |
377+
| Blazor xplat docs | `npm run check-mdx-links:blazor` |
378+
| Markdown reports | `npm run check-mdx-links:report:<platform>` |
379+
| Resolve-only broken-link reports | `npm run check-mdx-links:broken:<platform>` |
380+
381+
These scripts also check for ambiguous `ApiLink` references. If a symbol exists in more than one registry package and the link does not specify enough information to choose safely, the script prints an **Ambiguous ApiLinks** section, writes a `reports/api-link-ambiguity-report*.md` file, and exits with a failure.
382+
383+
Fix ambiguous links by adding a specific `pkg` or `kind` prop. If the correct target differs by platform, wrap platform-specific links in `PlatformBlock`.
384+
385+
Angular checks run the same generated-content sync used by Angular builds before scanning `docs/angular/src/content`. React, Web Components, and Blazor checks generate the selected platform output first, then scan raw xplat MDX files filtered through each language `toc.json` platform exclusions. This keeps report paths pointed at raw xplat source files while avoiding topics excluded from that platform.
386+
387+
Reports are written under `reports/`:
388+
389+
| Report | Meaning |
390+
|---|---|
391+
| `api-link-ambiguity-report*.md` | Registry duplicate keys and currently referenced ambiguous `ApiLink`s. |
392+
| `mdx-broken-links*.md` | Resolve-only broken or unresolved `ApiLink`s. |
393+
| `mdx-link-report*.md` | Full URL check output when the non-broken report scripts are used. |
394+
395+
Referenced ambiguities should be fixed before merging. Registry duplicate keys can remain in the report when no current MDX link references them.
396+
397+
# <a name='#api-link-registry-workflow'>ApiLink registry workflow</a>
398+
399+
The API registry flow is:
400+
401+
```mermaid
402+
flowchart TD
403+
A[api-docs] --> B[Generate API docs]
404+
B --> C[Generate API registry JSON]
405+
C --> D[Sync into igniteui-documentation]
406+
D --> E[ApiLink resolves type/member from registry]
407+
E --> F{Resolved?}
408+
409+
F -->|Yes| G[Render API link]
410+
G --> H[Link checker crawls URL]
411+
H --> I[Reported if unreachable / soft 404]
412+
413+
F -->|No| J[Render highlighted text only]
414+
J --> K[Reported as unresolved]
415+
```
416+
417+
The checker also detects duplicate registry matches:
418+
419+
```mermaid
420+
flowchart TD
421+
A[MDX ApiLink] --> B[Resolve candidate names]
422+
B --> C[Apply platform prefix/suffix rules]
423+
C --> D[Apply pkg and kind filters]
424+
D --> E[Match type in registry]
425+
E --> F[Match member case-insensitively]
426+
F --> G{How many registry symbols match?}
427+
428+
G -->|0| H[Unresolved ApiLink]
429+
G -->|1| I[Resolved ApiLink]
430+
G -->|2 or more| J[Ambiguous ApiLink]
431+
432+
H --> K[Write broken report]
433+
I --> L[Use canonical registry symbol and member]
434+
J --> M[Write ambiguity report and fail when enabled]
435+
```
436+
437+
Registry snapshots live under `src/data/api-link-index/<platform>/staging-latest.json`. The runtime `ApiLink` component and the checker both use these registries to choose the final URL.
438+
439+
Only referenced ambiguities are blocking. Duplicate registry keys listed in the report are informational until an MDX file references them without enough props to choose the intended symbol.
440+
441+
For the full workflow, package mappings, generated-content behavior, and practical fix loop, see [API-LINK-WORKFLOW.md](../API-LINK-WORKFLOW.md).
339442

340443
# <a name='#creating-shared-help-topics'>Creating shared help topics</a>
341444

@@ -369,4 +472,4 @@ Usage:
369472
- Use the `@xplat-images` alias which resolves to `docs/xplat/public/images/`.
370473
- Always provide a meaningful `alt` attribute.
371474
- Use `{Platform}` in the `alt` text when the image is platform-generic (e.g. `alt="{Platform} Grid Overview"`).
372-
- Responsive sizing and lazy loading are handled automatically by Astro — no extra classes or `data-srcset` attributes are needed.
475+
- Responsive sizing and lazy loading are handled automatically by Astro — no extra classes or `data-srcset` attributes are needed.

.github/skills/docfx-sync/SKILL.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,24 @@ These look like:
7171
|---|---|
7272
| `.../classes/igx{foo}component.html` | `<ApiLink type="Foo" />` |
7373
| `.../classes/igx{foo}component.html#{member}` | `<ApiLink type="Foo" member="member" />` |
74-
| `.../classes/igx{foo}directive.html` | `<ApiLink type="FooDirective" suffix={false} />` |
75-
| `.../interfaces/i{foo}.html` | `<ApiLink kind="interface" type="IFoo" suffix={false} prefixed={false} />` |
74+
| `.../classes/igx{foo}directive.html` | `<ApiLink type="FooDirective" />` |
75+
| `.../interfaces/i{foo}.html` | `<ApiLink kind="interface" type="IFoo" />` |
7676
| `.../enums/igx{foo}.html` | `<ApiLink kind="enum" type="Foo" />` |
77-
| `.../enums/{foo}.html` (no igx) | `<ApiLink kind="enum" type="Foo" prefixed={false} />` |
78-
| `.../functions/{foo}.html` | `<ApiLink kind="function" type="foo" prefixed={false} />` |
77+
| `.../enums/{foo}.html` (no igx) | `<ApiLink kind="enum" type="Foo" />` |
78+
| `.../functions/{foo}.html` | `<ApiLink kind="function" type="foo" />` |
7979

8080
**Prop reference:**
8181

8282
| Prop | Default | When to override |
8383
|---|---|---|
8484
| `type` | required | Short name, no `Igx` prefix — `"Grid"` not `"IgxGrid"` |
8585
| `kind` | `"class"` | Set `"interface"`, `"enum"`, `"type"`, `"function"`, `"variable"` as appropriate |
86-
| `suffix` | `true` | `false` for directives, utilities, interfaces (anything that isn't a `Component`) |
87-
| `prefixed` | `true` | `false` for interfaces (`IFoo`), enums/functions with no `Igx` prefix |
8886
| `member` | none | Property or method name from the URL anchor |
8987
| `label` | derived | Only when display text differs from the type name (e.g. `label="igx-grid"` for selector display) |
9088
| `pkg` | `"core"` | Angular docs **rarely** need this — use `pkg="charts"` for chart types, etc. |
9189

92-
**Important — `suffix={false}` traps:**
93-
- `InputGroup`, `Checkbox`, `DropDown`, `Overlay`, `List`, `Avatar`, `Icon`, `Badge`, `Button`, `Card` — these commonly appear **without** `Component` suffix in prose. Restore the `suffix={false}` if master had it.
94-
- `Combo` in overlay note context → `suffix={false}` (the note refers to `IgxCombo` selector, not `IgxComboComponent`)
90+
The generated ApiLink registry resolves prefix/suffix differences. Do not add
91+
`prefixed={false}` or `suffix={false}` for new links.
9592

9693
---
9794

@@ -134,7 +131,7 @@ JP content is at `docs/angular/src/content/jp/`. Apply the same fixes as EN. The
134131

135132
1. **Do not add `pkg=` to angular-specific files** unless the type is from a sub-package (charts, gauges, maps, etc.). Angular docs default to `pkg="core"` which resolves to `igniteui-angular`.
136133

137-
2. **Do not remove `suffix={false}` or `prefixed={false}`** from existing ApiLink components — these were added deliberately and are often required for the link to resolve correctly.
134+
2. **Do not add legacy prefix/suffix override props**. The registry should resolve the actual API symbol name.
138135

139136
3. **Do not use `.md` extensions** in links — the remark plugin does not handle them and produces dead links at build time.
140137

0 commit comments

Comments
 (0)