@@ -167,7 +167,7 @@ interface LinkifyOptions {
167167 * @param html - The HTML to process
168168 * @param options - Dependencies map and optional relative import resolver
169169 */
170- function linkifyImports ( html : string , options ?: LinkifyOptions ) : string {
170+ export function linkifyModuleSpecifiers ( html : string , options ?: LinkifyOptions ) : string {
171171 const { dependencies, resolveRelative } = options ?? { }
172172
173173 const getHref = ( moduleSpecifier : string ) : string | null => {
@@ -196,7 +196,7 @@ function linkifyImports(html: string, options?: LinkifyOptions): string {
196196 // Match: from keyword span followed by string span containing module specifier
197197 // Pattern: <span style="...">from</span><span style="..."> 'module'</span>
198198 let result = html . replace (
199- / ( < s p a n [ ^ > ] * > f r o m < \/ s p a n > ) ( < s p a n [ ^ > ] * > ) ( [ ' " ] [ ^ ' " ] + [ ' " ] ) < \/ s p a n > / g,
199+ / ( < s p a n [ ^ > ] * > ? f r o m < \/ s p a n > ) ( < s p a n [ ^ > ] * > ) ( [ ' " ] [ ^ ' " ] + [ ' " ] ) < \/ s p a n > / g,
200200 ( match , fromSpan , stringSpanOpen , moduleSpecifier ) => {
201201 const href = getHref ( moduleSpecifier )
202202 if ( ! href ) return match
@@ -285,7 +285,7 @@ export async function highlightCode(
285285
286286 // Make import statements clickable for JS/TS languages
287287 if ( IMPORT_LANGUAGES . has ( language ) ) {
288- html = linkifyImports ( html , {
288+ html = linkifyModuleSpecifiers ( html , {
289289 dependencies : options ?. dependencies ,
290290 resolveRelative : options ?. resolveRelative ,
291291 } )
0 commit comments