import type { CodeFinder } from '../finder/finder' ; import { markAsIgnore , setDblclickHandlers , textToImage } from './mutatorUtil' ; export const DescriptionMutator = { async embedPlantUmlImages ( finders , webPageUrl , $root ) { await Promise . all ( finders . map ( async ( finder ) => { const contents = await finder . find ( webPageUrl , $root ) ; for ( const content of contents ) { if ( ! content . text . length ) continue ; const $text = content . $text ; let $image ; if ( markAsIgnore ( $text ) ) { $image = await textToImage ( content . text ) ; markAsIgnore ( $image ) ; $image . insertAfter ( $text ) ; } else { $image = $text . next ( ) ; } setDblclickHandlers ( $text , $image ) ; } } ) ) ; } , } ;