From e21291bbf3d1085390524e3c13f70bbd3b09ce7d Mon Sep 17 00:00:00 2001 From: Julien Huang Date: Tue, 23 Dec 2025 15:13:22 +0100 Subject: [PATCH] feat: add foldable tags through shiki-transformer-fold --- client/app/components/HydrationIssue.vue | 6 ++++++ package.json | 3 ++- pnpm-lock.yaml | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/app/components/HydrationIssue.vue b/client/app/components/HydrationIssue.vue index 67b9c0a..3617f09 100644 --- a/client/app/components/HydrationIssue.vue +++ b/client/app/components/HydrationIssue.vue @@ -4,6 +4,7 @@ import { diffLines, type ChangeObject } from 'diff' import { transformerNotationDiff } from '@shikijs/transformers' import type { HydrationMismatchPayload, LocalHydrationMismatch } from '../../../src/runtime/hydration/types' import { HYDRATION_ROUTE } from '../../../src/runtime/hydration/utils' +import { transformerRenderHtmlFold, attachFoldToggleListener } from 'shiki-transformer-fold' const props = defineProps<{ issue: Issue @@ -31,6 +32,7 @@ async function render(pre: string, post: string) { const diff = diffLines(pre, post, { stripTrailingCr: true, ignoreNewlineAtEof: true, newlineIsToken: true, ignoreWhitespace: true }) diffHtml.value = await codeToHtml(generateDiffHtml(diff), { theme: 'github-dark', lang: 'html', transformers: [ + transformerRenderHtmlFold(), transformerNotationDiff(), ], }) @@ -72,6 +74,10 @@ function removeSelf() { body: JSON.stringify({ id: [props.issue.id] }), }) } + +onMounted(() => { + attachFoldToggleListener() +})