angular/adev/shared-docs/pipeline/api-gen/rendering/templates/highlight-ts.tsx
Matthieu Riegler e220a615d1 docs(docs-infra): patch port changes from main (#63394)
This sync some of the changes we have on the main branch will allow more upcomming changes to land via a single PR.

PR Close #63394
2025-08-26 09:48:03 -07:00

21 lines
767 B
TypeScript

/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {h} from 'preact';
import {RawHtml} from './raw-html';
import {codeToHtml} from '../../../shared/shiki.mjs';
import {get} from 'http';
import {getHighlighterInstance} from '../shiki/shiki.mjs';
/** Component to render a header of the CLI page. */
export function HighlightTypeScript(props: {code: string}) {
const result = codeToHtml(getHighlighterInstance(), props.code, 'typescript');
const withScrollTrack = result.replace(/^(<pre class="shiki)/, '$1 docs-mini-scroll-track');
return <RawHtml value={withScrollTrack} className="docs-code" />;
}