-
Notifications
You must be signed in to change notification settings - Fork 1
chore: sync with upstream models #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7a8b461 to
6f59238
Compare
- Unify details/example as `DetailsBlock`: typst/typst#7011 - Add `global_attributes` to `GroupBody`: typst/typst#7083 - Change codepoint to string in `Symbol`: typst/typst#6489 - Add `deprecation_until`: typst/typst#6617 Relates-to: typst-community#15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the program logic up to this point is probably fine.
There was a problem hiding this comment.
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 synchronizes the codebase with upstream Typst model changes from v0.13.1 to v0.14.0-rc.1, focusing on backward compatibility while supporting new documentation features.
Key changes:
- Unified details/example structure into
DetailsBlocktype with normalization utilities - Added deprecation version tracking (
deprecation_until) with enhanced warning display - Added support for global attributes in typed HTML function groups
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/normalizeModel.ts | New utility module providing backward-compatible normalization for deprecation info and detail blocks |
| src/types/model.ts | Updated type definitions to support both v0.13.1 and v0.14.0-rc.1 formats with union types |
| src/translation/ja-JP.tsx | Added Japanese translations for deprecation warnings and example titles (partially incomplete) |
| src/translation/index.tsx | Updated translation type definitions to support new deprecation and example title parameters |
| src/translation/en-US.tsx | Added English translations for deprecation warnings with version info and example titles |
| src/components/ui/type2href.ts | Added documentation comment for global attributes parameter ID generation |
| src/components/ui/FunctionParameters.tsx | Refactored to use normalized detail blocks and support global attributes rendering |
| src/components/ui/FunctionDisplay.tsx | Refactored to render detail blocks using normalization utilities with example folding support |
| src/components/ui/DeprecationWarning.tsx | Enhanced to use normalization utilities and display version-specific deprecation information |
| src/components/templates/GroupTemplate.tsx | Added rendering support for global attributes section in function groups |
| src/components/templates/FuncTemplate.tsx | Updated to use normalization utilities for deprecation and detail blocks |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| {normalizeDetailBlocks(param).map((block) => { | ||
| switch (block.kind) { | ||
| case "html": | ||
| return ( | ||
| <div class="text-gray-700"> | ||
| <HtmlContent html={block.content} /> | ||
| </div> | ||
| ); | ||
| case "example": | ||
| return ( | ||
| <details class="folding-example group"> | ||
| <summary class="flex items-center gap-1 text-sm font-medium text-blue-600 cursor-pointer hover:text-blue-800"> | ||
| <div class="w-4 h-4 text-gray-400 transform transition-transform duration-200 group-open:rotate-90"> | ||
| <ChevronRightIcon /> | ||
| </div> | ||
| <Translation | ||
| translationKey="showExample" | ||
| title={block.content.title} | ||
| /> | ||
| </summary> | ||
| <div class="mt-2 bg-white p-3 rounded-md border border-gray-200 text-sm"> | ||
| <HtmlContent html={block.content.body} /> | ||
| </div> | ||
| </details> | ||
| ); | ||
| default: | ||
| return null; | ||
| } | ||
| })} |
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The map callback should add a key prop to each returned element. Use block index or a combination of block.kind with index to ensure unique keys for proper React rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hono JSX doesn't require key.
| {normalizeDetailBlocks(func).map((block) => { | ||
| switch (block.kind) { | ||
| case "html": | ||
| return <HtmlContent html={block.content} />; | ||
| case "example": | ||
| return isExampleFolding ? ( | ||
| <details class="folding-example group"> | ||
| <summary class="flex items-center gap-1 text-sm font-medium text-blue-600 cursor-pointer hover:text-blue-800"> | ||
| <div class="w-4 h-4 text-gray-400 transform transition-transform duration-200 group-open:rotate-90"> | ||
| <ChevronRightIcon /> | ||
| </div> | ||
| <Translation | ||
| translationKey="showExample" | ||
| title={block.content.title} | ||
| /> | ||
| </summary> | ||
| <div class="mt-2 bg-white p-3 rounded-md border border-gray-200 text-sm"> | ||
| <HtmlContent html={block.content.body} /> | ||
| </div> | ||
| </details> | ||
| ) : ( | ||
| <div class="bg-gray-50 p-4 rounded-md border border-gray-200"> | ||
| <HtmlContent html={block.content.body} /> | ||
| </div> | ||
| ); | ||
| default: | ||
| return null; | ||
| } | ||
| })} |
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The map callback should add a key prop to each returned element. Use block index or a combination of block.kind with index to ensure unique keys for proper React rendering.
| {normalizeDetailBlocks(content).map((block) => { | ||
| switch (block.kind) { | ||
| case "html": | ||
| return ( | ||
| <div class="my-4 text-gray-700"> | ||
| <HtmlContent html={block.content} /> | ||
| </div> | ||
| ); | ||
| case "example": | ||
| // This will never reach for Typst v0.13.1 and v0.14.0-rc.1 documentations. | ||
| return ( | ||
| <div class="my-6 bg-gray-50 p-4 rounded-md border border-gray-200"> | ||
| {block.content.title} | ||
| <HtmlContent html={block.content.body} /> | ||
| </div> | ||
| ); | ||
| default: | ||
| return null; | ||
| } | ||
| })} |
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The map callback should add a key prop to each returned element. Use block index or a combination of block.kind with index to ensure unique keys for proper React rendering.
|
Shall we go ahead and merge this PR for now? |


Note
This PR is ready for review, although not finished yet.
I have left
fourthree TODOs in the files: two Japanese translations, and a possible upstream bug.and a place needing a design decisionChanges:
Unify details/example as
DetailsBlock: Improve example rendering of parameters and nested functions typst/typst#7011Add
deprecation_until: Hint that deprecated items will be removed in0.15.0typst/typst#6617Add
global_attributestoGroupBody: Streamline docs for typed HTML API typst/typst#7083(Added a prototype implementation, needs discussion)
Change codepoint to string in
Symbol: Allow multi-character symbols typst/typst#6489(No update needed)
All changes are compatible with both v0.13.1 and v0.14.0-rc.1 formats.
Relates-to: #15
To review this PR, I recommend checking the page
/docs/reference/layout/place/(official v0.14.0-rc.1 / official v0.13.1 / jp / PR preview).This page covers most complexities —
place.dxhas an example mixed in the content,place.scopeis a string parameter, andplace.flushis a scoped definition.Better review it commit by commit.
If you find it really hard to review such a big PR, I can split it.
However, since these changes are inherently coupled, splitting might make the
mainbranch broken after merging some but not all of the PRs.Besides, I suggest reviewing and merging #16 first.