From 297aa2c8d7cd4976bd69f78a575e8dd4fbf7db36 Mon Sep 17 00:00:00 2001 From: na-trium-144 <100704180+na-trium-144@users.noreply.github.com> Date: Wed, 7 Oct 2026 18:50:04 +0900 Subject: [PATCH] =?UTF-8?q?term=E3=81=8C=E3=81=9D=E3=81=AE=E3=82=BB?= =?UTF-8?q?=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E8=87=AA=E8=BA=AB=E3=82=92?= =?UTF-8?q?=E6=8C=87=E3=81=99=E3=81=A8=E3=81=8D=E3=83=AA=E3=83=B3=E3=82=AF?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@docs/[lang]/[pageId]/pageContent.tsx | 15 ++++++---- app/markdown/term.tsx | 29 ++++++++++++++++++- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/app/(docs)/@docs/[lang]/[pageId]/pageContent.tsx b/app/(docs)/@docs/[lang]/[pageId]/pageContent.tsx index 95453b1f..a1e872a9 100644 --- a/app/(docs)/@docs/[lang]/[pageId]/pageContent.tsx +++ b/app/(docs)/@docs/[lang]/[pageId]/pageContent.tsx @@ -23,6 +23,7 @@ import { useRouter } from "next/navigation"; import { revalidateChatAction } from "@/actions/revalidateChat"; import { RegenerateStreamEvent } from "@/api/chat/regenerate-section/route"; import { captureException } from "@sentry/nextjs"; +import { CurrentSectionContextProvider } from "@/markdown/term"; interface PageContentProps { splitMdContent: SectionWithDiff[]; @@ -120,12 +121,14 @@ export function PageContent(props: PageContentProps) { path={path} /> )} - {/* ドキュメントのコンテンツ */} - + + {/* ドキュメントのコンテンツ */} + +
(null); +export function CurrentSectionContextProvider({ + sectionId, + children, +}: { + sectionId: SectionId; + children: ReactNode; +}) { + return ( + + {children} + + ); +} + /** * https://github.com/ut-code/utcode-learn/blob/main/src/components/Term/index.tsx をもとに独自実装 * Copyright (c) 2023 ut.code(); @@ -55,6 +76,7 @@ export default function Term(props: JSX.IntrinsicElements["q"] & ExtraProps) { // @docs/lang/pageId/page.tsx で取得したものをcontextに渡してそれを取得する const { lang, page, termDefinitions } = useContext(TermDefinitionContext) ?? {}; + const currentSectionId = useContext(CurrentSectionContext); const langEntry = usePagesListForLang(lang); @@ -159,6 +181,11 @@ export default function Term(props: JSX.IntrinsicElements["q"] & ExtraProps) { ); } + if (currentSectionId === term.id) { + // このセクション自身へのリンクは表示しない + return props.children; + } + const pageEntry = langEntry?.pages.find((p) => p.slug === term.page); return (