{#each partitionHtml(html, rules) as part} {@const match = findAndTransform( rules, (rule) => rule.split.test(part), (rule) => ({ ...rule, props: { ...rule.props, matches: [...(part.match(rule.match) ?? [])], html } }) )} {#if match} {:else} {@html part} {/if} {/each}