docs(docs-infra): fix heading ID generation and display

Ensures that custom heading IDs are properly handled
This commit is contained in:
SkyZeroZx
2026-02-08 13:42:31 -05:00
committed by Andrew Kushnir
parent fd293d3397
commit dd15efb7c3
3 changed files with 10 additions and 4 deletions
@@ -104,6 +104,10 @@ describe('markdown to html', () => {
expect(h2HeaderId).toBe('my-custom-id');
expect(h2AnchorHref).toBe(`#${h2HeaderId}`);
// Verify that the custom ID syntax is removed from the displayed text
expect(h2Anchor?.textContent?.trim()).toBe('My heading');
expect(h2Anchor?.textContent).not.toContain('{#');
});
it('should be able to parse heading with a valid tag in a code block', () => {
@@ -34,7 +34,9 @@ export function headingRender(
const link = customId ?? getIdFromHeading(headingText);
const label = parsedText.replace(/`(.*?)`/g, '<code>$1</code>');
// Replace code backticks and remove custom ID syntax from the displayed label
let label = parsedText.replace(/`(.*?)`/g, '<code>$1</code>');
label = label.replace(/{#\s*[\w-]+\s*}/g, '').trim();
const normalizedLabel = label.replace(/<\/?code>/g, '');
return `
@@ -222,7 +222,7 @@ Each parameter is written as an attribute prefixed with `let-` with a value matc
</ng-template>
```
### Using `NgTemplateOutlet`
### Using `NgTemplateOutlet` {#using-ngtemplateoutlet-with-parameters}
You can bind a context object to the `ngTemplateOutletContext` input:
@@ -234,11 +234,11 @@ You can bind a context object to the `ngTemplateOutletContext` input:
<ng-container [ngTemplateOutlet]="myFragment" [ngTemplateOutletContext]="{topping: 'onion'}" />
```
### Using `ViewContainerRef`
### Using `ViewContainerRef` {#using-viewcontainerref-with-parameters}
You can pass a context object as the second argument to `createEmbeddedView`:
```angular-ts
```ts
this.viewContainer.createEmbeddedView(this.myFragment, {topping: 'onion'});
```