Skip to content

Conversation

@3w36zj6
Copy link
Member

@3w36zj6 3w36zj6 commented Oct 29, 2025

close #23

This pull request standardizes the styles across the library pages and fixes any broken designs.

Copy link
Contributor

Copilot AI left a 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 refactors UI components to simplify styling and improve markup structure. The changes focus on removing unnecessary styling, restructuring heading layouts to properly wrap flex containers, and cleaning up the function path generation logic.

  • Simplified genPath function to use native join() instead of manual concatenation
  • Restructured heading elements to wrap flex containers in a div for proper layout
  • Removed excessive styling from various UI components (borders, backgrounds, padding)

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/ui/genPath.ts Simplified path generation logic to use join(".") directly
src/components/ui/FunctionParameters.tsx Removed styling from parameter containers and examples, restructured heading flex layout
src/components/ui/FunctionDisplay.tsx Simplified example display styling and color scheme
src/components/ui/FunctionDefinition.tsx Refactored to use semantic HTML (<pre><code>), added conditional dot rendering, restructured to use span elements
src/components/templates/TypeTemplate.tsx Wrapped heading flex content in divs for proper layout
src/components/templates/GroupTemplate.tsx Wrapped heading flex content in divs for proper layout
src/components/templates/FuncTemplate.tsx Wrapped heading flex content in divs, removed indentation and borders from scoped definitions
src/components/templates/CategoryTemplate.tsx Changed oneliner rendering from plain div to paragraph element

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@YDX-2147483647 YDX-2147483647 left a comment

Choose a reason for hiding this comment

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

It's a great work to systematically refactor the styling!

However, contents on pages are quite diverse, and there are a few edge cases that seem confusing now… Please see the comments below for details.

Maybe we should a keep a memo of edge cases and add links to the official and typst-jp website, like the one on editing docs?

Besides, I notice that you've organized lots of hard-coded colors into typ-* classes. It's helpful and even paves the way for future support of dark mode.

<div class="pl-4">{item.oneliner}</div>
<div>
<p>{item.oneliner}</p>
</div>
Copy link
Member

@YDX-2147483647 YDX-2147483647 Nov 1, 2025

Choose a reason for hiding this comment

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

I think the original style looks better. It weakens item.oneliner by adding an indent and decreasing the distance to item.name, making it easier to scan quickly and locate an item.

Example: https://typst-docs-web.netlify.app/en-us-v0.14.0/reference/foundations/

Besides, it might be possible to unify the style here in <CategoryTemplate> and the style for param.strings in <FunctionParameters>.

<pre>
<code>
<span>{funcName}</span>
{funcName !== "" && <span class="typ-punct">.</span>}
Copy link
Member

Choose a reason for hiding this comment

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

This style assumes that there is no additional . in funcName. According to the following, it's true at present.

$ jq '.. | select(type == "object" and has("path")) | .path | length' docs.json | sort | uniq --count
    101 0
    421 1

I suggest adding a comment to genPath.ts:

For Typst v0.14.0, the path is either empty or has only one item.

return (
<div
key={method.name}
class="mb-8 pb-6 border-b border-gray-100 last:border-0"
Copy link
Member

Choose a reason for hiding this comment

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

Here you've removed the border.
See outline.entry.{inner,body,page}. These border lines lines help distinguish the functions.

图片

↓ After the removal, body seems to be a parameter of inner?

I suggest adding the border back.
If you just don't like the border, please increase the spacing here.

/>
</summary>
<div class="mt-2 bg-white p-3 rounded-md border border-gray-200 text-sm">
<div class="my-4">
Copy link
Member

Choose a reason for hiding this comment

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

The vertical margin has been increased here, but I think my-4 is too large.

See place.{float,dx}:

图片 图片

This also applies to example blocks in <FunctionParameters>.

Note

Typst v0.14.0 has changed the format here. In v0.13.1, there's at most one example block for each <FunctionDisplay>; but now, there might be multiple example blocks, and they are embeded in the description.

<HtmlContent html={param.default} />
</span>
</p>
<div class="flex flex-wrap items-start gap-2">
Copy link
Member

Choose a reason for hiding this comment

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

param.default is misaligned and not highlighted.

For example, place.clearance:

图片

Using an inline version of <HtmlContent>, adding a trailing space after the colon in en-US translation, and changing pre code span.typ-* to code span.typ-* would probably fix it.
However, that's too much. I suggest fixing it in a separate PR.

<p class="prose">
	<Translation translationKey="defaultValue" />
	<span dangerouslySetInnerHTML={{ __html: param.default }} />
</p>
图片

);
})}
</div>
<div>
Copy link
Member

Choose a reason for hiding this comment

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

I think the new style is less readable than the old style or the official style.

I can hardly distinguish headings from descriptions…

图片

Maybe adjusting spacings or font weights?

@3w36zj6
Copy link
Member Author

3w36zj6 commented Nov 1, 2025

Thank you for reviewing this PR despite the large number of changes. I will make the necessary corrections to each part later.

By the way, regarding the headings, I am planning to introduce explicit styles in #26. What do you think about this approach?

@netlify
Copy link

netlify bot commented Nov 2, 2025

Deploy Preview for typst-docs-web ready!

Name Link
🔨 Latest commit d6f67aa
🔍 Latest deploy log https://app.netlify.com/projects/typst-docs-web/deploys/6907071de132e20008a749e9
😎 Deploy Preview https://deploy-preview-28--typst-docs-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annotations to scoped functions in GroupTemplate are inconsistent with those in FuncTemplate

3 participants