/*! * @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 {CodeLineRenderable} from '../entities/renderables.mjs'; export function CodeLine(props: {line: CodeLineRenderable}) { const line = props.line; const className = `line ${line.isDeprecated ? `shiki-deprecated` : ''}`; // extracting the line that is wrapped by shiki's // The captured group is greedy to include all nested elements const pattern = /]*\bclass=["']line["'][^>]*>(.*)<\/span>/s; const match = line.contents.match(pattern); // let highlightedContent = match ? match[1] : line.contents; if (line.id) { return ( ); } else { return ; } }