Repository navigation
docs: use Fumadocs TypeTable on data model pages - #3791
marcklingen wants to merge 4 commits into
Conversation
Convert Score/ScoreConfig and Experiments dataset object field tables to TypeTable, register the component for MDX, and keep the same fields in Markdown/PDF export. Co-authored-by: Marc Klingen <marcklingen@users.noreply.github.com>
Add three switchable TypeTable variants (flat table default, CornerBox chrome, always-visible rows) and drop the Fumadocs rounded card. Toggle with ?typetable=1|2|3. Co-authored-by: Marc Klingen <marcklingen@users.noreply.github.com>
Keep the rectangular table styling and drop the query-param variants. Recommend TypeTable in AGENTS.md for object/field data models. Co-authored-by: Marc Klingen <marcklingen@users.noreply.github.com>
The markdown/PDF export only needs the authored object literal, so evaluate that expression and drop the hand-rolled field lexer. Co-authored-by: marc.klingen <marc.klingen@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude review |
There was a problem hiding this comment.
Claude Code Review
No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.
Tip: disable this comment in your organization's Code Review settings.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. Because it introduces a new build-time JSX→Markdown export path (renderTypeTable in lib/markdown-component-renderers.js, using new Function to evaluate the TypeTable type literal) that two live docs pages now depend on, a quick human look would still be worthwhile.
What was reviewed:
renderTypeTable/extractJsxExpressioninlib/markdown-component-renderers.js— scoped to plain JS object literals authored in-repo, not external input; throws clearly on non-literal expressions.- Pipe-escaping in code-span cells: the
mediafield'sobject | nulltype (content/docs/evaluation/experiments/data-model.mdx:167) is escaped to\|and wrapped in backticks — CommonMark doesn't process backslash escapes inside code spans, so the exported.md/PDF table may show a literal backslash there; cosmetic only, table structure isn't broken. - Heading structure in both migrated
.mdxpages — single H1, proper##/###/####nesting, explicit[#anchor]markers preserved. src/overrides.cssadditions — scoped to the new.lf-type-tableclass, using existing CSS variables, no changes to other selectors.
Extended reasoning...
Overview
The PR adds a Fumadocs TypeTable convention (components/docs/type-table.tsx), registers it in mdx-components.tsx, migrates the Score/ScoreConfig and Dataset/DatasetItem/DatasetRun/DatasetRunItem data-model pages to it, adds matching CSS in src/overrides.css, and — critically for parity — adds a Markdown-export renderer (replaceTypeTablesWithMarkdown/renderTypeTable/extractJsxExpression) in lib/markdown-component-renderers.js so .md/PDF/md-src consumers still see the same attribute tables. A small shim file (.agents/AGENTS.md) is also synced to match root guidance already documenting this exact convention.
Security risks
Low. new Function is used to evaluate the type prop's object-literal source, but that source is always repository-authored MDX content compiled at build time, not user- or request-supplied input, so this isn't an injection vector in the traditional sense — it's equivalent in risk to existing hand-rolled JSX parsers already in this file (e.g. for CardGroup/Academy components). No auth, secrets, or data-exposure paths are touched.
Level of scrutiny
Medium. The page content and CSS changes are simple and mechanical, but the new renderTypeTable markdown-export logic is genuinely new parsing/rendering code with edge cases (non-literal expressions, JSX in descriptions, table-cell escaping) that a multi-round automated review already exercised without finding a bug it flagged. My own reading turned up one concrete, low-severity cosmetic case: the media field's "object | null" type value gets escaped to \| and wrapped in backticks, and per CommonMark, backslash escapes don't apply inside code spans — so the rendered .md/PDF output may literally show a backslash rather than a clean pipe. It doesn't corrupt table structure and is far from severe, but it's a concrete, currently-present instance in this exact diff rather than a purely hypothetical future risk, so I think it's worth a human glancing at the exported Markdown for that one page before merging.
Other factors
The overall design directly implements a convention the project's own AGENTS.md/CLAUDE.md already calls for (TypeTable for data models, with Score/Dataset pages named as the intended examples), and the CSS/heading/anchor conventions are all followed correctly. Given the change is well-scoped and no functional bug was found, but it does introduce new export-path code with at least one minor, real rendering nuance, deferring with a specific note feels more honest than an unqualified approval.
Simplified rebase of #3767 onto current
main.Uses Fumadocs
TypeTableon two data-model pages:/docs/evaluation/scores/data-model— Score and ScoreConfig fields/docs/evaluation/experiments/data-model— Dataset, DatasetItem, DatasetItemMediaReference, DatasetRun, DatasetRunItemPath/use-case tables stay markdown. Field names, types, required flags, and documented defaults match the previous tables.
What changed vs #3767
#3767 still includes the already-merged Fumadocs 16.15.4 upgrade, so the GitHub diff is 18 files and mixes upgrade fallout with TypeTable work.
This branch:
main(7 files)new Functionevaluation of the authored object literalTypeTableis registered inmdx-components.tsx.lib/markdown-component-renderers.jsstill exports each TypeTable as a markdown field table so.md/ PDF /md-srckeep the same attributes.Styling is the flat table (no radius, 1px structure border, no card shadow). AGENTS.md recommends TypeTable for object/field data models.
The PR appears safe to merge, with a non-blocking recommendation to add regression coverage for TypeTable Markdown exports.
Summary
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Data-model MDX] --> B[Registered TypeTable wrapper] B --> C[Fumadocs web rendering] A --> D[TypeTable Markdown renderer] D --> E[Plain Markdown / md-src] E --> F[PDF output]Reviews (1) · Last reviewed commit: "refactor: evaluate TypeTable literals in..."