Skip to content

ut.code(); LearnのremarkTermを実装し、キーワードのポップアップ・リンク - #224

Merged
na-trium-144 merged 22 commits into
mainfrom
utcodelearn-term
Aug 2, 2026
Merged

ut.code(); LearnのremarkTermを実装し、キーワードのポップアップ・リンク#224
na-trium-144 merged 22 commits into
mainfrom
utcodelearn-term

Conversation

@na-trium-144

@na-trium-144 na-trium-144 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

close #118

[[用語]]

と書くと、term: - 用語 が定義されている別のセクションへのリンクになり、ポップアップでその内容も表示されます。

markdown書式も利用可能です。 [[ほげ**ふが**]]term: - ほげふが へのリンクになり、表示は「ほげふが」になります。ただし **[[ふが]]** はリンクの色が優先されるのに対し [[**ふが**]] は強調の色が優先されます。


close #189

[[./1-foo]]
[[./1]]

と書くと、同じ言語のページID 1-foo またはindex 1 (ページのindexはindex.ymlの記述順で0-based) へのリンクになり、表示は「第1章」になります

[[./prev]]
[[./next]]

と書くと、同じ言語の前のページ・次のページへのリンクになり、表示は「第1章」(実際の章番号)になります


close #129

GitHubのalert記法の、NOTE TIP WARNING CAUTION が使えます。
IMPORTANT はwarningに置き換えられます。(daisyuiに対応するテーマ色がないため)

> [!NOTE]  
> Highlights information that users should take into account, even when skimming.

その他

  • term、ページリンク、編集可能コードブロック、をチャットでは無効化
  • getPagesListgetPagesListForLang に分割 → contextを追加し usePagesList, usePagesListForLang でクライアントコンポーネントからも取得可能にする
  • tooltipのoverflowを修正 close replのヘルプが左に見切れている #204
  • tooltipが画面外に出るとき位置を自動調整する機能を追加
  • alertのタグは<blockquote>ではなく<aside>
    • (asideはチャットでも使っているが)
  • メインコンテンツのタグを<section>に変更

@na-trium-144
na-trium-144 marked this pull request as draft July 22, 2026 07:13
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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
na-trium-144 marked this pull request as ready for review July 31, 2026 14:43
@na-trium-144
na-trium-144 force-pushed the utcodelearn-term branch 2 times, most recently from 635c19b to b3b1aa9 Compare August 1, 2026 09:05
@na-trium-144
na-trium-144 merged commit c18dab0 into main Aug 2, 2026
9 checks passed
@na-trium-144
na-trium-144 deleted the utcodelearn-term branch August 2, 2026 09:02
@na-trium-144
na-trium-144 requested a review from Copilot August 2, 2026 09:02
@na-trium-144
na-trium-144 restored the utcodelearn-term branch August 2, 2026 09:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) + client Term component with Floating UI popover, and generate termDefinitions.json during docs meta generation.
  • Add GitHub Alerts ([!NOTE], [!TIP], etc.) rendering using an aside.alert-* mapping with icons.
  • Refactor pages list fetching to getPagesListForLang and expose pages list to client components via PagesListContextProvider, 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 thread app/markdown/term.tsx
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 thread app/markdown/term.tsx
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 thread app/markdown/markdown.tsx
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;
}
na-trium-144 added a commit that referenced this pull request Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants