ut.code(); LearnのremarkTermを実装し、キーワードのポップアップ・リンク - #224
Merged
Conversation
na-trium-144
marked this pull request as draft
July 22, 2026 07:13
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
my-code | 3427d9a | Commit Preview URL Branch Preview URL |
Aug 02 2026, 09:10 AM |
na-trium-144
force-pushed
the
utcodelearn-term
branch
from
July 22, 2026 07:16
b7a15f1 to
4ac7ac3
Compare
<p> cannot be descendant of <p> エラーを避けるためportal型tooltipのほうがよい
na-trium-144
force-pushed
the
utcodelearn-term
branch
from
July 31, 2026 13:11
7c5cf6c to
f72dba0
Compare
na-trium-144
marked this pull request as ready for review
July 31, 2026 14:43
na-trium-144
force-pushed
the
utcodelearn-term
branch
2 times, most recently
from
August 1, 2026 09:05
635c19b to
b3b1aa9
Compare
na-trium-144
force-pushed
the
utcodelearn-term
branch
from
August 1, 2026 09:07
b3b1aa9 to
d8270fd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the docs Markdown rendering pipeline by adding ut.code(); Learn-style [[...]] term/page linking with popover term previews, GitHub-style alert blocks, and safer client-side access to the pages list via context—plus tooltip overflow/positioning fixes in terminal UI.
Changes:
- Add
[[...]]parsing (remark plugin) + clientTermcomponent with Floating UI popover, and generatetermDefinitions.jsonduring docs meta generation. - Add GitHub Alerts (
[!NOTE],[!TIP], etc.) rendering using anaside.alert-*mapping with icons. - Refactor pages list fetching to
getPagesListForLangand expose pages list to client components viaPagesListContextProvider, plus tooltip overflow fixes for REPL/exec modals.
Reviewed changes
Copilot reviewed 28 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/generateDocsMeta.ts | Generate per-language termDefinitions.json alongside sections metadata. |
| README.md | Document new frontmatter term: and Markdown features (alerts, internal links). |
| package.json | Add dependencies for floating UI, children text extraction, unist remove; bump daisyui. |
| package-lock.json | Lockfile updates for added/bumped dependencies. |
| app/terminal/repl.tsx | Fix tooltip clipping by using auto-position wrapper and overflow changes. |
| app/terminal/page.tsx | Adjust alert icon styling (text-info). |
| app/terminal/modal.tsx | Allow overflow-visible so tooltips aren’t clipped. |
| app/terminal/exec.tsx | Same tooltip/overflow adjustments as REPL. |
| app/terminal/editor.tsx | Ensure modal text color is set (text-base-content). |
| app/sidebar.tsx | Switch sidebar to read pages list from context rather than props. |
| app/pagesListContext.tsx | New client context + hooks for accessing pages list (and per-lang). |
| app/page.tsx | Update daisyui alert class usage. |
| app/markdown/tooltipPosition.tsx | New helper component to auto-adjust tooltip horizontal position. |
| app/markdown/term.tsx | New client Term renderer with popover + internal page link support. |
| app/markdown/remarkTerm.ts | New remark plugin converting [[...]] to a q node for term handling. |
| app/markdown/remarkGithubAlerts.ts | New remark plugin converting GitHub alert blockquotes into aside.alert-*. |
| app/markdown/multiHighlight.tsx | Adjust underline styling (offset handled globally now). |
| app/markdown/markdown.tsx | Add remark plugins + split into base vs interactive rendering components. |
| app/markdown/codeBlock.tsx | Add interactive flag to disable exec/repl/editor features in non-doc contexts. |
| app/lib/docs.ts | Add term frontmatter, getPagesListForLang, term definition generation/stripping. |
| app/layout.tsx | Provide pages list via context provider; Sidebar no longer needs prop. |
| app/globals.css | Set a global underline offset. |
| app/featureCard.tsx | Render markdown as interactive where needed. |
| app/daisyAlertIcon.tsx | Allow icon color to be customized via className. |
| app/api/chat/route.ts | Use getPagesListForLang (avoid loading full pages list). |
| app/(docs)/@docs/[lang]/[pageId]/pageContent.tsx | Make docs markdown interactive; compute prev/next from context. |
| app/(docs)/@docs/[lang]/[pageId]/page.tsx | Provide term definitions via context; use getPagesListForLang. |
| app/(docs)/@chat/chat/[chatId]/page.tsx | Simplify resolving lang/page from pagePath. |
| app/(docs)/@chat/chat/[chatId]/chatArea.tsx | Resolve page/lang display via pages list context. |
| .gitignore | Ignore generated termDefinitions.* outputs under public/docs/**. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+110
to
+112
| // ./1, ./1-foo, ./next, ./prev →同じ言語のドキュメントへのリンクで、「第n章」 | ||
| const pageIndexMatch = termText.match(/^.\/(\d+)$/); | ||
| const pageSlugMatch = termText.match(/^.\/([0-9a-zA-Z_-]+)$/); |
Comment on lines
+128
to
+146
| const currentPageIndex = langEntry?.pages.findIndex((p) => p.slug === page); | ||
| if ( | ||
| pageSlugMatch && | ||
| langEntry && | ||
| pageSlugMatch[1] === "prev" && | ||
| currentPageIndex !== undefined | ||
| ) { | ||
| // ./prev → 前のページ | ||
| return internalLink(langEntry.pages[currentPageIndex - 1]); | ||
| } | ||
| if ( | ||
| pageSlugMatch && | ||
| langEntry && | ||
| pageSlugMatch[1] === "next" && | ||
| currentPageIndex !== undefined | ||
| ) { | ||
| // ./next → 次のページ | ||
| return internalLink(langEntry.pages[currentPageIndex + 1]); | ||
| } |
Comment on lines
+64
to
+71
| <WithAutoTooltipPosition | ||
| as="a" | ||
| className="link link-info tooltip tooltip-info before:whitespace-pre" | ||
| href={href} | ||
| data-tip={`外部リンク\n${href}`} | ||
| target="_blank" | ||
| {...props} | ||
| /> |
Comment on lines
+88
to
+92
| item.children.forEach((item, idx) => { | ||
| if (idx == 0) return; | ||
| if (idx == 1 && item.type === "break") { | ||
| return; | ||
| } |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #118
と書くと、
term: - 用語が定義されている別のセクションへのリンクになり、ポップアップでその内容も表示されます。markdown書式も利用可能です。
[[ほげ**ふが**]]はterm: - ほげふがへのリンクになり、表示は「ほげふが」になります。ただし**[[ふが]]**はリンクの色が優先されるのに対し[[**ふが**]]は強調の色が優先されます。close #189
と書くと、同じ言語のページID
1-fooまたはindex1(ページのindexはindex.ymlの記述順で0-based) へのリンクになり、表示は「第1章」になりますと書くと、同じ言語の前のページ・次のページへのリンクになり、表示は「第1章」(実際の章番号)になります
close #129
GitHubのalert記法の、
NOTETIPWARNINGCAUTIONが使えます。IMPORTANTはwarningに置き換えられます。(daisyuiに対応するテーマ色がないため)その他
getPagesListをgetPagesListForLangに分割 → contextを追加しusePagesList,usePagesListForLangでクライアントコンポーネントからも取得可能にする<blockquote>ではなく<aside>に<section>に変更